Questions tagged [r-grid]

grid is an R package providing low-level plotting facilities.

grid is an package providing low-level ting facilities.

Repositories

Vignettes

  • Vignettes for this package are not available online. Use browseVignettes() or vignette(package = "grid") to access them.

Books

Other resources

Related tags

Unrelated tags

341 questions
9
votes
1 answer

Wider margins for grid.arrange function

I'm building a composition of plots (created using ggplot2) running the function grid.arrange. Although I have the composition done, I want the plots not to be so close to the margins. I know for other type of plots, the function par() allows to…
R18
  • 1,476
  • 1
  • 8
  • 17
9
votes
1 answer

Cannot change font in textGrob

I am hoping someone can help out with custom text labels in grid.arrange. I have four plots that I am arranging in a column with a shared legend below. I am trying to change the font of the "left" label in grid.arrange but I cannot figure out how…
EsotericPunk
  • 91
  • 1
  • 4
9
votes
1 answer

ggplot2: How to get merge functionality of facet_grid()'s labeller=label_both and facet_wrap()'s ncol options?

I am creating a boxplot using ggplot2. I am able to create the boxplot successfully but I am having problems when merging two features with faceting in ggplot2: When faceting, strip text should contain column name & column value (as given by…
Komal Rathi
  • 4,164
  • 13
  • 60
  • 98
9
votes
3 answers

How to change position of grid.draw

I am arranging plots generated by ggplot2. I have to use print to print out plots and grid.draw to display legend. Sample Code: p0 <- ggplot(data = iris, geom = 'blank', aes(y = Petal.Width, x = Petal.Length, color = Species)) +…
Autumn
  • 575
  • 1
  • 9
  • 20
8
votes
1 answer

How do you relate ggplot2 grobs back to the data?

Given a ggplot of, for example, points, how would you find out the row of data that a given point corresponded to? A sample plot: library(ggplot2) (p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() + facet_wrap(~ gear) ) We can get the grobs…
Richie Cotton
  • 118,240
  • 47
  • 247
  • 360
8
votes
2 answers

How to put plots without any space using plot_grid?

I'm doing an arrangement of 2x2 plots. The plots share the same axis, so I want to put them together, e.g. This code: library(ggplot2) library(cowplot) Value <- seq(0,1000, by = 1000/10) Index <- 0:10 DF <- data.frame(Index, Value) plot <-…
Daniel Valencia C.
  • 2,159
  • 2
  • 19
  • 38
8
votes
3 answers

Multiple leaflets in a grid

I have 4 leaflet objects: A, B, C, D. I would like to plot them in a 2 by 2 grid, but I have been having a difficult time trying to do this. My initial thought was to use ggplot and facet_grid, but ggplot does not know how to deal with objects of…
John Smith
  • 393
  • 1
  • 6
  • 17
8
votes
1 answer

Control the number of arrow heads

I am using ggplot2 in R to produce a scatter graph of ordered points in a dataframe joined by a continuous line. On this line I would like to place several arrowheads that show the order of the points in the dataframe. I can place an arrow between…
RoachLord
  • 993
  • 1
  • 14
  • 28
8
votes
2 answers

How plot bars on top of grid lines when using barplot?

I am using grid() inside of barplot(). Because I want the bars to be plotted on top of the grid, I use the panel.first argument. However, the grid lines do not match the ticks of y-axis. Can anyone tell me how to solve this problem? My code is like…
Carter
  • 1,563
  • 8
  • 23
  • 32
8
votes
2 answers

grid.layout doesn't like respect and compound units

Using unit.pmax as the default comparison of widths/heights in gtable is proving harder than I'd hoped; after several hours of head scratching I've narrowed it down to this situation: library(grid) w <- list(unit(1,"null"), unit(1,"null")) class(w)…
baptiste
  • 75,767
  • 19
  • 198
  • 294
8
votes
1 answer

arrow() in ggplot2 no longer supported

Installed R 2.15.2 on a new machine and ggplot2. The grid package is no longer supported in this latest version of R, but ggplot2 uses grid for the arrow() function, as in these examples. http://docs.ggplot2.org/current/geom_segment.html Haven't…
user2037931
  • 83
  • 1
  • 3
7
votes
3 answers

Combine multiple facet strips across columns in ggplot2 facet_wrap

I am trying to combine facet strips across two adjacent panels (there is always two adjacent ones with the same first ID variable, but with two different scenarios, let's call them "A" and "B"). I am not particularly wedded to the gtable + grid…
Björn
  • 644
  • 10
  • 23
7
votes
1 answer

Estimate percentage of plot taken up by legend in ggplot2

I have some ggplot functionality, but I want to give users a warning in case they abuse it heavily. The problem is this: if there are many groups and the group names are long, the legend becomes so big it takes up the entire plot: But if I were to…
Vandenman
  • 3,046
  • 20
  • 33
7
votes
2 answers

Strange space on grid.arrange plot

I am trying to add footnote to grid.arrange graph. I presented my idea in this reproducible example: ) library(ggplot2) library(gridExtra) library(grid) library(gtable) summary(anscombe) p1 <- ggplot(anscombe) + geom_point(aes(x1, y1), color =…
peter_c
  • 91
  • 3
7
votes
1 answer

inset map using ggplot2

I'm just trying to make a simple study area map that also contains an inset of the state that I am working in (North Carolina). I would like to convert the inset map to a grob object to plot it within the main study area map, then use ggsave to save…
Jason
  • 892
  • 1
  • 8
  • 19
1 2
3
22 23