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

element replacement in grid unit vector

I've been baffled by this a few times already, so here's a made-up question for others who might stumble upon the same problem. Consider this grid unit vector, a = unit(1:3, c("cm", "in", "npc")) I want to replace some elements with new values. The…
baptiste
  • 75,767
  • 19
  • 198
  • 294
5
votes
3 answers

Find the perimeter of a subset of a near-regular grid of points

Let us consider a set of near-regular grids in 2-D. These grids are adjacent (neighbouring grids have one or more same vertices) to the neighbouring grids. Here are the sample of 10 grids with the coordinates of the vertices (longitude,latitude) are…
Janak
  • 653
  • 7
  • 25
5
votes
3 answers

Draw 3x3 square grid in R

I got a list of number (n=9) and would like to draw them out in a 3*3 square grid and each grid fill with corresponding number. How can I do this in R without installing additional package e.g. plotrix. Many thanks!
user3446735
  • 125
  • 1
  • 3
  • 8
5
votes
2 answers

R lattice xyplot doesn't match grid to axes' ticks (not multiplot)

I'm trying to produce a plot with lattice's xyplot by the following code: set.seed(123) #### make it…
PavoDive
  • 6,322
  • 2
  • 29
  • 55
5
votes
1 answer

Plot multiple ggplot plots on a single image with left alignment of the plots and a single legend

I would like to place several different ggplot plots into a single image. After much exploring, I am finding that ggplot is fantastic at generating a single plot or a series of plots if the data is formatted correctly. However, when you want to…
Justace Clutter
  • 2,097
  • 3
  • 18
  • 31
5
votes
1 answer

Assign grid.arrange to object

I want to arrange plots with grid.arrange to make more complex coplots and then use grid.arrange to combine these complex coplots. I am using the following solution (https://stackoverflow.com/a/13295880/1000343) in this task to arrange mutliple…
Tyler Rinker
  • 108,132
  • 65
  • 322
  • 519
5
votes
2 answers

change the background color of grid.arrange output

I am using grid.arrange from gridExtra package to put two graphs on one page and save it to a png file. I like to change the background colour of the final png file that is produced by grid.arrange. Is it possible? I was not able to come across any…
user1471980
  • 10,127
  • 48
  • 136
  • 235
4
votes
1 answer

Exact dimensions of linetype spacing and size

This is mostly a follow-up question on a previous one. Given that in ggplot2 and grid there are different linetypes and spacings vary between line sizes, what is their relationship? There are two things I do not quite understand. How is the line…
teunbrand
  • 33,645
  • 4
  • 37
  • 63
4
votes
1 answer

How to plot an aligned text on severals lines / colomns?

I am creating a "page" via several lines and columns with aligned text (left/right/top/bottom). I would like to use the grid.arrange() function but I can't do it. I read in an old post that the grid_plot() function does the job. So my code is #…
Eric
  • 41
  • 2
4
votes
1 answer

Two separate y-axis titles for two facets of a plot while keeping the facet top strip labels using ggplot2

I have this data frame: > str(DF) 'data.frame': 14084 obs. of 6 variables: . . . $ Variables: chr "Height" "Height" "Height" "Height" ... $ Values : num 245 129 301 162 123 125 115 47 46 135 ... $ Year : Factor w/ 2 levels…
Muneer
  • 209
  • 1
  • 3
  • 13
4
votes
1 answer

Customize label element position in ggplot using gtable/grob

I am creating GIS maps for DC using ggplot in R. I am trying to customize my legend bar and labels. I can move legend keys but not the label using gtable_filter. I would like to move the last label '1' near it's legend bar like other labels. Any…
Deepak
  • 55
  • 6
4
votes
1 answer

Fill up bezier drawn in R using grid

I have a drawing as below: library(grid) grid.newpage() grid.rect(x = 0.1, y = 0.4, width = unit(0.18, "npc"), height = unit(0.6, "npc")) grid.rect(x = 0.65, y = 0.4, width = unit(0.6, "npc"), height = unit(0.6, "npc")) for…
TheRimalaya
  • 4,232
  • 2
  • 31
  • 37
4
votes
1 answer

How to draw rectangle using grid package

I need to draw a rectangle on my diagram to highlight different changes. I need to use grid package. I tried to use the grid.rect but it doesn't work. I want that my rectangle looks like on the picture. On the left part of the picture you can see my…
Viola
  • 487
  • 1
  • 10
  • 33
4
votes
1 answer

How can I store grobs in a list and pass them to grobTree()?

So I'm trying to make a list of grobs and then pass them into grobTree(), but my list items don't get read in as grobs by do.call(). Here's my code: library(purrr) library(grid) library(gridExtra) library(ggplot2) qplot(displ, year, data =…
4
votes
1 answer

Can I assume that it is always possible to open a pdf NULL device in R?

For various functions in my cowplot package, I need to be able to convert ggplot2 plots into grobs, via the ggplotGrob() function. A known problem in this context is that ggplotGrob() requires an open graphics device, and depending on the graphics…
Claus Wilke
  • 16,992
  • 7
  • 53
  • 104