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.

The recommended grid package is included in every distribution of the R software. As such, it provides a low-level framework for building up all kinds of static graphics. The core component of grid-based graphics is a grob, which in its most basic form is a generic class of objects that describe a graphical component. The most basic grobs are simple shapes such as pointsGrob, polygonGrob, etc., but new objects can be derived from those primitive objects, and are often assembled into a grob tree, or gTree, which holds together multiple shapes together with a specific layout.

Examples of high-level, complex grobs are the complete plots generated by the ggplot2 and lattice packages.

146 questions
0
votes
1 answer

Adding a subtitle text to a grid.table plot

I have a question very similar to what discussed here: Adding text to a grid.table plot my ultimate goal however is to have a title 60mm from the top of the table, and a subtitle 2mm below the title. I came up with this code that is almost there but…
Angelo
  • 1,594
  • 5
  • 17
  • 50
0
votes
0 answers

Splitting table to multiple pages using tablegrob

What is the best way to split a table to multiple pages? When table goes more than one page, only the first page is shown and not the rest. library(gridExtra) library(gtable) library(gdata) table = tableGrob(rowCountDf) …
nsivakr
  • 1,565
  • 2
  • 25
  • 46
0
votes
1 answer

Adjust the multiple fills(color) of different label regions

0 Forgive my stupid to disturb you again. @teunbrand answered my question yesterday and I used it in my real data but it doesn’t work . Here is my question in stackoverfow:Can I adjust the fill(color) of different label regions when using ggh4x…
花落思量错
  • 352
  • 1
  • 11
0
votes
1 answer

ggplot2 custom grob will not extend outside of plot

I am trying to use annotate_custom to create lines outside of my plot to divide my axis into sections. I am aware of this post that asks a similar question, but for some reason, using a negative value as the min value for the line does not extend…
h09812349
  • 109
  • 6
0
votes
1 answer

Adding a line to the top of a tableGrob and insetting the table into another plot

Two questions: How do I add a line to the top of a table that I've made using tableGrob? Here is my code with my data: library(gridExtra) library(grid) library(gtable) find_cell <- function(table, row, col, name="core-bg"){ l <- table$layout …
0
votes
1 answer

R (package superheat) - adding color (or rectangles) to the dendrograms

Minimal example and package documentation (https://rlbarter.github.io/superheat/): library(superheat) superheat(mtcars, # scale the matrix columns scale = TRUE, left.label = "none", # add row dendrogram …
Gustavo
  • 11
  • 2
0
votes
2 answers

Remove NA and only fill cells containing numbers in tableGrob

I have a table (top.table) I would like to display in a ggplot, but am having issues reformatting the table. I need to format it such that all NA elements are blank, and only fill with specified colors if there is a number contained within the…
user13589693
  • 369
  • 1
  • 8
0
votes
0 answers

Pesky border around a grob inset map

I made this map and it's nearly perfect except for the inset map has this pesky white borer around it. I would like for the inset to just have the black line border of the actual panel border, but not that white background that's coming along with…
0
votes
1 answer

Create a North-West arrow with ggplot

I'm using annotation_custom to make a custom legend with arrows. Unfortunately, all arrows seem to have a downward angle (heading South-West or North-East) and I'm striving to make an upward arrow (heading North-West). Here is a reproducible…
Dan Chaltiel
  • 7,811
  • 5
  • 47
  • 92
0
votes
3 answers

grid arrange textGrob() and ggplots. Title and subtitle gridExtra

Basically, I want to add a title and subtitle to a grid.arrange() plot. I have plot_list which is a list of 15 ggplots and tg <- textGrob('Title', gp = gpar(fontsize = 13, fontface = 'bold')) sg <- textGrob('Subtitle', gp = gpar(fontsize = 10)) But…
piblo95
  • 123
  • 1
  • 2
  • 10
0
votes
0 answers

How to save the plot output and object output of a function call in R

I am making a function call in R. The function returns a list and in it has a call to plot(). From this one call, I need to record the plot as an object and store the list as a separate object. I need to store the plot because I later give it to…
biosorcery
  • 41
  • 4
0
votes
1 answer

Pass changed geom from object to other ggplot

I first make a plot df <- data.frame(x = c(1:40, rep(1:20, 3), 15:40)) p <- ggplot(df, aes(x=x, y = x)) + stat_density2d(aes(fill='red',alpha=..level..),geom='polygon', show.legend = F) Then I want to change the geom_density values…
CodeNoob
  • 1,988
  • 1
  • 11
  • 33
0
votes
1 answer

adding a logo to a grid.table PDF output in R

I have a table output in pdf format and I want to customise it to bring in line with a corporate theme. However, I'm new to this area in R and still finding it difficult to find my feet in adding logos. My original dataset is composed of over 600…
Pryore
  • 510
  • 9
  • 22
0
votes
1 answer

How to display results of summary() as plot/grob?

Context: I have a dataset of 50+ features, and I would like to produce a boxplot, histogram, and summary statistic for each of them, for presentation purposes. That makes 150+ plots. The code I have used to do the above mentioned is as…
Bharat Desai
  • 123
  • 1
  • 15
0
votes
1 answer

Grob arguments from a data.frame to ggplot2

How can I pass the arguments of a set of grobs (ximin, xmax, ymin, ymax) from a data.frame to the annotation_custom function (ggplot2). The following example illustrates the problem. # Grobs a <- ggplot(diamonds, aes(carat)) + geom_histogram(fill =…
Ushuaia81
  • 495
  • 1
  • 6
  • 14
1 2 3
9
10