Questions tagged [grob]
stands for **gr**aphical **ob**ject, the generic drawing component in the grid framework of R graphics. Grobs can be very primitive, such as text, rectangles, lines, or complex objects such as full plots built up from many lower-level components.
grob
155
questions
1
vote
0
answers
94
views
ggplot2 error: "`unit()`: ! 'x' and 'units' must have length > 0" (::grid package in R)?
I'm trying to create a custom ggplot2 geom called geom_geoheat, but I'm running into an error when converting the geom to a grob. I am using ggprotos of GeomTile and GeomRect (where tile inherits most ...
2
votes
1
answer
49
views
Use ggplot2 to loop through multiple plots and add a table
I am trying to produce a large volume of plots with data tables underneath. The plot will contain an individual store's sales by year for two different products. I also need a table underneath ...
0
votes
0
answers
21
views
Change grob size to fit across whole landscape page
I am trying to get a plot to occupy the whole of a landscape page. I am using Rmarkdown and knitting a pdf document. I have also tried to change the chunk option and no luck, please help before I pull ...
1
vote
1
answer
60
views
Why is this table grob not printing?
I'm trying to print a series of plots and a table grob to a single PDF file. The code executes without any errors, but the table doesn't show up in the output PDF file. Why? What did I do wrong?
...
1
vote
1
answer
201
views
arrangeGrob() and similar alternatives do not accept a list of grobs . At grid.draw, returns: Error in gList(...) : only 'grobs' allowed in "gList"
I am making a large volume of plots from survey data that requires the entire text of each question to be displayed next to the resulting bar chart. Arranging a grid of grobs seems the best way to do ...
0
votes
0
answers
36
views
Unable to save a plot to a folder. Error in `annotation_custom()`: ! Problem while converting geom to grob
I'm using a past mentor's code that previously worked but I can't figure out what to do about this error. I'm using fish density to look at the effects of treatment of restored side channels on fish.
#...
2
votes
1
answer
78
views
How do I combine grobs to create a closed shape using grid in R?
I am currently writing a ggplot2 extension, and in the process I am trying to create a filled shape using grid, with certain sides being defined by function grobs. I am unsure how to take a tree of ...
13
votes
1
answer
345
views
How to draw segment with round end that does NOT extend beyond values
I am somewhat surprised that this has never caught my attention (I guess I've never drawn much with round line ends until today).
When drawing a segment with round line end, this is "of course&...
0
votes
1
answer
121
views
Left align table in Grob
Is there a way to align a table in a Grob to the left side of the panel instead of having it centred?
In the example bellow you can see that the table is in the centre of the lower panel, but I would ...
1
vote
1
answer
73
views
Rotate a R plot with dynamic plot area
I'm trying to rotate a plot to be incorporated into a shiny application.
I found how to rotate a plot. To get it right it seems you need to fiddle with the the height and width of the viewport making ...
0
votes
0
answers
24
views
Filling a circle with patterns in R using MikeFC's svgparser and minisvg
I can't replicate the result of filling the circle with the pattern object. It will only draw a circle with no pattern inside it. I am following MikeFC's instructions found here: text
The entirety of ...
0
votes
1
answer
198
views
R - How to change the width of a column in a gtable
I am creating a gtable consisting of 3 x ggplot grobs using cbind, but I would like to make the middle column less wide than the 1st and 3rd column. How would I go about doing this?
The centre column ...
0
votes
0
answers
15
views
Created a list of heatmaps but can visualize/save/seperate individually
I'm creating a list of heatmaps (baseplot package) from a list of matrices (protein expression data).
I used lapply and it looks like this
Heatgraphs <- lapply(names(splitmatrix),
...
2
votes
2
answers
108
views
Problem with cowplot in R: when paneling grobs and exporting as pdf, bullets turn into ellipses
I have a rather peculiar problem in paneling with cowplot and exporting the result as a PDF file.
Consider the following MWE:
# Load libraries
library(consort)
library(cowplot)
library(ggplotify)
# ...
2
votes
1
answer
143
views
Programmatically position image on ggplot using annotation_custom
I am trying to create a function (inside an R package) that adds an image to the lower right corner of a ggplot. Since this will be included in a R package, I want this function to programmatically ...