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
7
votes
2 answers

raster package: Lines around each cell

I want to have black lines around each cell of a raster. Below is the example data. I mean, instead of this frame/borderless cells I want this(cells with borders) How can I achieve this? library(raster) require(graphics) require(grDevices) …
Novice
  • 307
  • 2
  • 11
7
votes
2 answers

Preserving aspect ratio in R's grid graphics

To draw a "crossed" rectangle of height 2 times larger than its width using the low-level graphics package facilities I call: xlim <- c(0, 500) ylim <- c(0, 1000) plot.new() plot.window(xlim, ylim, asp=1) rect(xlim[1], ylim[1], xlim[2],…
cenka
  • 221
  • 1
  • 7
7
votes
3 answers

How to control font size in png?

I am trying to make figures for a manuscript, that should be written with MS Word, which does not accept figures in pdf format. The journal asks first draft with figures embedded in the Word file. These figures should have resolution minimum of 300…
Mikko
  • 7,530
  • 8
  • 55
  • 92
6
votes
2 answers

Convert units from npc to native using grid in R

The core of my problem: I'm attempting to convert npc units to native units using the grid package's convertUnit, convertX and convertY functions. (npc=normalized parent coordinates, possibly known as ndc units, normalized device coordinates to some…
Andrew
  • 141
  • 1
  • 6
6
votes
2 answers

How can I use grid to edit a ggplot2 object to add math expressions to facet labels?

I need to put Greek letters into facet labels using facet_wrap() in ggplot2. I found a Link describing the same for facet_grid(). I applied this for my data, using the following code: levels(parameters) <- c(expression(alpha), expression(beta)) p…
Dan
  • 63
  • 1
  • 4
6
votes
1 answer

Placing two venn diagrams on one chart

Using VennDiagram package I'm generating two graphs in the following manner: # First graph VennDiagram::draw.pairwise.venn( area1 = 100, area2 = 70, cross.area = 30, category = c("A1", "B1"), fill = c("#00204DFF", "#FFEA46FF") )…
Konrad
  • 17,740
  • 16
  • 106
  • 167
6
votes
1 answer

Limit lattice plots to viewports?

I would like to fit a whole lattice plot in a small region of an existing plot. xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos, type = "a") pushViewport(viewport(.2, .7, .2, .2)) grid.rect(gp=gpar(fill="white")) gives me this: So…
VitoshKa
  • 8,387
  • 3
  • 35
  • 59
6
votes
2 answers

How to add arrow using grid package

I want to add the arrow using grid package which will highlight the important part of my diagram. I want that the arrow will look like on the picture on the right side. On the left part is my diagram created by the code below and on the right part…
Viola
  • 487
  • 1
  • 10
  • 33
6
votes
2 answers

How do I manually fit a viewport with a fixed aspect ratio into its parent such that no space is wasted like ggplot can do?

I have a viewport which has to have a fixed aspect ratio as it has to have equal distance between x and y units in its native coordinate system. I want to fit this viewport into a parent viewport such that it will scale to the largest extent…
akraf
  • 2,965
  • 20
  • 44
6
votes
1 answer

cbind on ggplotGrob objects fails with "Error in mmm < each : comparison of these types is not implemented"

This appears to be similar to an issue that @baptiste was trying to work around back in 2014. I am revisiting code I wrote back in June that involved creating three ggplotGrobs and combining them with a call to cbind. Now, this code fails with the…
scooteR
  • 185
  • 7
6
votes
1 answer

Add a scale bar and a north arrow outside of the plot area of a facetted map plot

I wish to add a scale bar and a north arrow outside of the plot area of a facetted map plot. As an example, consider the following facetted map plot, as seen in a blog post by Max Marchi (link): # Load the data airports <-…
R. Joe
  • 367
  • 5
  • 13
6
votes
1 answer

Fontsize error when creating new Geom in ggplot2

I am trying to create a new geom that will create a wind radii chart from hurricane data. The data needed to run this came be generated from the following: storm_observation <- data_frame(longitude = c(-89.6, -89.6, -89.6), …
G.Ambrose
  • 219
  • 2
  • 7
6
votes
1 answer

R: plot in a grid layout over multiple pages

I'd like to arrange a 3x3 grid layout over 3 pages of a PDF file. I'd like to plot in arbitrary grid locations across the three pages. I know how to arrange multiple subplots using some option like layout=c(3,3). I can figure out how to arrange a…
Mike Dewar
  • 10,945
  • 14
  • 49
  • 65
6
votes
1 answer

How to merge vertical cells in tableGrob output tables in R?

I have a question similar to the one here, where OP aimed to merge the headers of the column present in the table horizontal merging. Here I wish to merge groups of cells which are vertically lined. The following is my target table design made in…
Lune3414
  • 144
  • 1
  • 9
6
votes
1 answer

R: ggplot background gradient coloring

I would like to generate ggplot’s with gradient coloring, filling both plot panel and its background, as herein shown. As you can see the gradient background coloring encompasses both plot panel and its background. At the moment, only an…
GiorgioG
  • 116
  • 6