gtable

The layout packages that powers ggplot2

https://github.com/r-lib/gtable

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (18.8%) to scientific vocabulary

Keywords

r

Keywords from Contributors

package-creation date-time ropensci tidy-data
Last synced: 10 months ago · JSON representation

Repository

The layout packages that powers ggplot2

Basic Info
  • Host: GitHub
  • Owner: r-lib
  • License: other
  • Language: R
  • Default Branch: main
  • Homepage: https://gtable.r-lib.org
  • Size: 5.69 MB
Statistics
  • Stars: 93
  • Watchers: 11
  • Forks: 18
  • Open Issues: 1
  • Releases: 8
Topics
r
Created over 14 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License Code of conduct

README.Rmd

---
output: github_document
---



```{r}
#| label: setup
#| include: false
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
set.seed(42L)
options(width = 90)
```

# gtable 


[![R-CMD-check](https://github.com/r-lib/gtable/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/gtable/actions/workflows/R-CMD-check.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version/gtable)](https://CRAN.R-project.org/package=gtable)
[![Codecov test coverage](https://codecov.io/gh/r-lib/gtable/graph/badge.svg)](https://app.codecov.io/gh/r-lib/gtable)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)


gtable is a layout engine built on top of the grid package. It is used to abstract away the creation of (potentially nested) grids of viewports into which graphic objects can be placed. gtable makes it easy to ensure alignment of graphic elements and piecemeal compositions of complex graphics. gtable is the layout engine powering [ggplot2](https://ggplot2.tidyverse.org) and is thus used extensively by many plotting functions in R without being called directly.

## Installation

You can install the released version of gtable from [CRAN](https://CRAN.R-project.org) with:

``` r
install.packages("gtable")
```

or use the remotes package to install the development version from [GitHub](https://github.com/r-lib/gtable)

```r
# install.packages("pak")
pak::pak("r-lib/gtable")
```

## Example
ggplot2 uses gtable for laying out plots, and it is possible to access the gtable representation of a plot for inspection and modification:

```{r}
#| message: false
library(gtable)
library(ggplot2)

p <- ggplot(mtcars, aes(mpg, disp)) + geom_point()

p_table <- ggplotGrob(p)

p_table
```

A gtable object is a collection of graphic elements along with their placement in the grid and the dimensions of the grid itself. Graphic elements can span multiple rows and columns in the grid and be gtables themselves allowing for very complex automatically arranging layouts.

A gtable object is itself a grob, and can thus be drawn using standard functions from the grid package:

```{r}
#| fig-alt: >
#|   A scatterplot of miles per gallon against displacement based on the mtcars
#|   dataset. The plot is rendered by first converting the ggplot object to a
#|   gtable and then plotting the gtable
library(grid)
grid.draw(p_table) # alternative use plot(p_table)
```

While most people will interact with gtable through ggplot2, it is possible to build a plot from the ground up.

```{r}
#| fig-alt: >
#|   A scatterplot of random numbers. The scatterplot is created by combining
#|   separate grobs created with grid using gtable.
# Construct some graphical elements using grid
points <- pointsGrob(
  x = runif(10),
  y = runif(10),
  size = unit(runif(10), 'cm')
)
xaxis <- xaxisGrob(at = c(0, 0.25, 0.5, 0.75, 1))
yaxis <- yaxisGrob(at = c(0, 0.25, 0.5, 0.75, 1))

# Setup the gtable layout
plot <- gtable(
  widths = unit(c(1.5, 0, 1, 0.5), c('cm', 'cm', 'null', 'cm')),
  heights = unit(c(0.5, 1, 0, 1), c('cm', 'null', 'cm', 'cm'))
)

# Add the grobs
plot <- gtable_add_grob(
  plot,
  grobs = list(points, xaxis, yaxis),
  t = c(2, 3, 2),
  l = c(3, 3, 2),
  clip = 'off'
)

# Plot
grid.draw(plot)
```

Owner

  • Name: R infrastructure
  • Login: r-lib
  • Kind: organization

GitHub Events

Total
  • Create event: 3
  • Release event: 1
  • Issues event: 17
  • Watch event: 6
  • Delete event: 2
  • Push event: 23
  • Pull request event: 4
Last Year
  • Create event: 3
  • Release event: 1
  • Issues event: 17
  • Watch event: 6
  • Delete event: 2
  • Push event: 23
  • Pull request event: 4

Committers

Last synced: 12 months ago

All Time
  • Total Commits: 210
  • Total Committers: 11
  • Avg Commits per committer: 19.091
  • Development Distribution Score (DDS): 0.595
Past Year
  • Commits: 15
  • Committers: 2
  • Avg Commits per committer: 7.5
  • Development Distribution Score (DDS): 0.067
Top Committers
Name Email Commits
hadley h****m@g****m 85
Winston Chang w****n@s****g 59
Thomas Lin Pedersen t****5@g****m 50
Kohske Takahashi @ jurina t****e@g****m 4
Teun van den Brand 4****d 3
Paul Murrell p****l@s****z 3
Mara Averick m****k@g****m 2
baptiste b****e 1
R. Mark Sharp r****p@m****m 1
Mikko Korpela m****l@i****i 1
Brandon Hurr b****r@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 58
  • Total pull requests: 46
  • Average time to close issues: about 3 years
  • Average time to close pull requests: 9 months
  • Total issue authors: 21
  • Total pull request authors: 13
  • Average comments per issue: 1.19
  • Average comments per pull request: 2.22
  • Merged pull requests: 33
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 4
  • Pull requests: 4
  • Average time to close issues: 2 days
  • Average time to close pull requests: 3 days
  • Issue authors: 2
  • Pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.5
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • hadley (15)
  • thomasp85 (9)
  • wch (9)
  • baptiste (6)
  • clauswilke (2)
  • kohske (2)
  • yingeddi2008 (1)
  • jtoloe (1)
  • fawda123 (1)
  • raivokolde (1)
  • mvaudel (1)
  • pasipasi123 (1)
  • ankhnesmerira (1)
  • zaid-golwala (1)
  • infotroph (1)
Pull Request Authors
  • thomasp85 (21)
  • teunbrand (7)
  • kohske (6)
  • wch (5)
  • baptiste (4)
  • batpigandme (2)
  • rmsharp (1)
  • retypepassword (1)
  • ArtemSokolov (1)
  • pmur002 (1)
  • mvkorpel (1)
  • bhive01 (1)
  • Eli-Berkow (1)
Top Labels
Issue Labels
upkeep (3)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • cran 746,575 last-month
  • Total docker downloads: 201,298,206
  • Total dependent packages: 146
    (may contain duplicates)
  • Total dependent repositories: 679
    (may contain duplicates)
  • Total versions: 13
  • Total maintainers: 1
cran.r-project.org: gtable

Arrange 'Grobs' in Tables

  • Versions: 10
  • Dependent Packages: 111
  • Dependent Repositories: 596
  • Downloads: 746,575 Last month
  • Docker Downloads: 201,298,206
Rankings
Downloads: 0.2%
Dependent repos count: 0.6%
Dependent packages count: 0.9%
Forks count: 4.2%
Stargazers count: 4.5%
Average: 4.6%
Docker downloads count: 17.3%
Maintainers (1)
Last synced: 11 months ago
conda-forge.org: r-gtable
  • Versions: 3
  • Dependent Packages: 35
  • Dependent Repositories: 83
Rankings
Dependent packages count: 1.9%
Dependent repos count: 3.8%
Average: 19.7%
Stargazers count: 35.6%
Forks count: 37.4%
Last synced: 10 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.0 depends
  • grid * imports
  • covr * suggests
  • ggplot2 * suggests
  • knitr * suggests
  • profvis * suggests
  • rmarkdown * suggests
  • testthat * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.4.1 composite
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pr-commands.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/pr-fetch v2 composite
  • r-lib/actions/pr-push v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite