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
95
votes
5 answers

How can I obtain an 'unbalanced' grid of ggplots?

With grid.arrange I can arrange multiple ggplot figures in a grid to achieve a multi-panel figure by using something like: library(ggplot2) library(grid) library(gridExtra) generate some ggplot2 plots , then plot5 <- grid.arrange(plot4, plot1,…
user441706
  • 1,370
  • 2
  • 16
  • 17
50
votes
2 answers

grid.arrange from gridExtras exiting with "only 'grobs' allowed in 'gList'" after update

I just updated R, R Studio, and a bunch of packages including ggplot2 and gridExtras on my Mac. Now gridExtras is failing in basic plotting with the error: "only 'grobs' allowed in "gList"" Here's some code that should work but does…
Mike Shea
  • 857
  • 1
  • 9
  • 13
41
votes
3 answers

Add a footnote citation outside of plot area in R?

I'd like to add a footnote citation to my 3-panel facet grid plot produced in R. It's a footnote to credit the data source. I'd ideally like to have it below and external to all three axes---preferably in the lower left. I'm using ggplot2 and…
Mittenchops
  • 18,633
  • 33
  • 128
  • 246
37
votes
2 answers

Grid of multiple ggplot2 plots which have been made in a for loop

as a new ggplot2 user, I am a bit lost with the amount of possibilities, and struggle to find on the net a simple answer to what I consider a simple problem. I would like to display multiple plots from ggplot2 on a same sheet, BUT knowing that these…
fstevens
  • 1,287
  • 1
  • 17
  • 28
20
votes
3 answers

Center-align legend title and legend keys in ggplot2 for long legend titles

I am having a hard time making the title of a legend center-aligned relative to the legend keys when the legend title is long. There is a question from a year ago that works for short titles, but it doesn't seem to work for long ones. Example, first…
Claus Wilke
  • 16,992
  • 7
  • 53
  • 104
19
votes
2 answers

One shared legend for a cowplot grid in R

I just built a grid with package cowplot (to label the plots from A-D). The plots are made with package ggplot2: pfour<-ggplot(four, aes(x=Concentration, y=Percentage, fill=Phenotype)) + geom_bar(stat='identity',color='black') + …
Kai Mayer
  • 197
  • 1
  • 1
  • 7
19
votes
1 answer

How to apply cross-hatching to a polygon using the grid graphical system?

Several functions in R's base graphical system, including rect() and polygon(), support cross-hatching via their angle= and density= arguments: x = c(0, 0.5, 1, 0.5) y = c(0.5, 1, 0.5, 0) par(mar=c(0,0,0,0)) plot.new() polygon(x, y, angle=45,…
Josh O'Brien
  • 159,210
  • 26
  • 366
  • 455
18
votes
3 answers

How can I use a graphic imported with grImport as axis tick labels in ggplot2 (using grid functions)?

I'm hoping I can combine the spiffy importing and drawing powers of grImport with the awesome graphing power of ggplot2, but I simply don't understand the grid system well enough to find an elegant way of achieving what I want. What I want is to…
18
votes
2 answers

Arrangement of large number of plots and connect with lines in r

I have a large number of small plots need to placed in a bigger plot canvase and arrange small plots into and connect them with lines. A small example will look like this: A to L are independent plots. The cordinate of their placement is…
jon
  • 11,186
  • 19
  • 80
  • 132
17
votes
3 answers

Add a transparent window/keyhole ggplot2 (grid)

Sometimes it is helpful to use a technique of adding a gray semi-transparent layer to an image and then cutting a keyhole into that layer to highlight a certain portion of the image below. Here is an example from a youtube vide: I do this with…
Tyler Rinker
  • 108,132
  • 65
  • 322
  • 519
17
votes
1 answer

Justification of multiple legends in ggmap/ggplot2

I am trying to make a map with two legends denoting shape and colour ("Type" and "Org" in the example below), and have the legends inset. I can place the legends, but I would like them to be left justified so that their left edges line up. I can't…
andyteucher
  • 1,393
  • 14
  • 21
16
votes
1 answer

R YaleToolkit: How to change the font size of tick labels on the sparklines?

I'm using this function for some quick and easy sparklines with R but I can't seem to work out how to change the font size to avoid ugly overlaps of the y-axis tick labels. Here's my code (see below for a reproducible example): sparklines(gamma.df,…
Ben
  • 41,615
  • 18
  • 132
  • 227
16
votes
1 answer

Arrange base plots and grid.tables on the same page

I have 2 plots (created using Base graphics) and 2 data frames that I would like to combine onto one sheet in a PDF. I'm using grid.table to create a tableGrobs from my data frames. I'm having a lot of difficulty formatting the PDF output. In…
ch-pub
  • 1,664
  • 6
  • 29
  • 52
16
votes
2 answers

Make a rectangular legend, with rows and columns labeled, in grid

I've got a ggplot where I'm mapping factors to both fill and alpha, like this: set.seed(47) the_data <- data.frame(value = rpois(6, lambda=20), cat1 = rep(c("A", "B"), each = 3), cat2 = rep(c("X", "Y",…
Gregor Thomas
  • 136,190
  • 20
  • 167
  • 294
15
votes
1 answer

How to create a grid of spatial points

library(reshape2) library(data.table) library(dplyr) library(magrittr) library(ggplot2) library(scales) library(gstat) library(DescTools) library(sp) #I want a colorado grid# data("colorado.grid") #making cordinates into spatial points…
Clinton Woods
  • 249
  • 1
  • 2
  • 11
1
2 3
22 23