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
15
votes
1 answer

How to plot barchart onto ggplot2 map

I have found similar answers to questions like this one, but most of them are using packages rworldmap, ggmap, ggsubplot or geom_subplot2d. See for example here or here. I'd like to know how I can plot other ggplot-objects such as a bar-chart onto…
Thomas
  • 1,392
  • 3
  • 22
  • 38
15
votes
4 answers

Information Dashboards in R with ggplot2

I'm looking to create a static dashboard viewable in a web browser. And I'd like to create something like what Stephen Few does in his book Information Dashboard Design. (see example at bottom) Ggplot2: Shouldn't be any issue producing the graphs…
user246211
  • 1,137
  • 1
  • 13
  • 23
14
votes
3 answers

Align multiple plots with varying spacings and add arrows between them

I have 6 plots which I want to align neatly in a two-step manner (see picture). Preferably, I'd like to add nice arrows. Any ideas? UPD. As my question started to gather negative feedback, I want to clarify that I've checked all the (partially)…
ikashnitsky
  • 2,941
  • 1
  • 25
  • 43
13
votes
3 answers

R adding a datatable to a ggplot graph using viewPorts : Scaling the Grob

I'm trying to add a data-table to a graph made in ggplot (similar to the excel functionality but with the flexibility to change the axis its on) I've had a few goes at it and keep hitting a problem with scaling so attempt 1)…
Tahnoon Pasha
  • 5,848
  • 14
  • 49
  • 75
12
votes
1 answer

Specifying ggplot2 panel width

I have two ggplots on the same page, and I'd like their panels to be the same width. Some sample data: dfr1 <- data.frame( time = 1:10, value = runif(10) ) dfr2 <- data.frame( time = 1:10, value = runif(10, 1000, 1001) ) One plot below…
Richie Cotton
  • 118,240
  • 47
  • 247
  • 360
12
votes
4 answers

Logarithmic grid for plot with 'ggplot2'

I am trying to create a plot with logarithmically spaced grids using ggplot2 just like in the below figure. I get equidistant grids, but not log spaced ones. I know I am missing some parameter which I don't seem to get as of now. I have seen a lot…
pravi
  • 2,029
  • 3
  • 13
  • 9
12
votes
1 answer

How to annotate ggplot2 qplot outside of legend and plotarea? (similar to mtext())

I would like to annotate my plots with a filename. With plot() I used mtext: plot(1:10) mtext("File xy-12-34-56.csv", 4) How can I do that with ggplot2 and qplot or ggplot? It should not collide with the legend. I found the commands annotate and…
Jonas Stein
  • 6,826
  • 7
  • 40
  • 72
11
votes
1 answer

Efficient way to map data to legend text color in ggplot2

I'm wondering if there's an efficient way to map data onto legend text color in ggplot2, just like we can do with axis text. Reproducible example follows. First, let's make a plot: library(ggplot2) library(dplyr) drv_counts <- mutate(mpg, …
Claus Wilke
  • 16,992
  • 7
  • 53
  • 104
11
votes
1 answer

grid.arrange ggplot2 plots by columns instead of by row using lists

I want create a multiplot of ggplot2 plots from a list using grid.arrange but arrange them by columns before doing it by rows. gg_list1 <- list(qplot(mpg, disp, data = mtcars), qplot(hp, wt, data = mtcars), …
Bonono
  • 827
  • 1
  • 9
  • 18
11
votes
1 answer

"zoom"/"scale" with coord_polar()

I've got a polar plot which uses geom_smooth(). The smoothed loess line though is very small and rings around the center of the plot. I'd like to "zoom in" so you can see it better. Using something like scale_y_continuous(limits = c(-.05,.7)) will…
ccoffman
  • 431
  • 4
  • 9
11
votes
1 answer

R - put ggplot grid lines in foreground

I would like to know if there is a way to let ggplot draw its grid lines in front of the plotted data. As far as I know, I can format almost everything easily by using theme() which works well so far. However, I don't find the option in which order…
Florian R. Klein
  • 1,375
  • 2
  • 15
  • 32
10
votes
2 answers

How to keep linetype spacing constant despite line size

I've been attempting to plot lines in either ggplot2 or grid with equal spacing between line segments when the sizes differ. However I've not been succesfull so I ask you for help. In the examples below, how can I keep the absolute spacing between…
teunbrand
  • 33,645
  • 4
  • 37
  • 63
10
votes
2 answers

Add margins with grid R package

I don't know how to specify margins for PDF printing with grid R package. I create a grid.arrange() object and I put it in a PDF like this : pdf('test.pdf',11.69,8.27) grid.arrange(textGrob('text1', gp=gpar(cex=4)), ncol=1,…
Ben
  • 185
  • 1
  • 10
10
votes
3 answers

Change text color for cells using TableGrob

Is there a way to individually change the color of the text of a cell when using tableGrob and ggplot2? For instance in the code below it'd be great if the cell with 1 could be blue and the cell with 2 could be red, with 3:8 all…
user3667133
  • 147
  • 2
  • 9
9
votes
1 answer

How To Edit Common Legend Title In ggarrange?

How do I edit a common legend title (make it bold font and enlarge the font size) using ggarrange? Based on the six plots I have (p1 to p6), I thought the following would work: p6 <- p6 + theme(legend.title = element_text(size = 15, face =…
shsh
  • 684
  • 1
  • 7
  • 18
1
2
3
22 23