[R] Styling gridExtra's title and left labels

Alastair alastair.andrew at gmail.com
Tue Aug 7 12:49:32 CEST 2012


Hi,

I'm using the gridExtra package to combine some graphs like in the
arrangeGrob example. Each of the graphs has a title but they appear much
larger than the overall combined plot title and left axis label. Does anyone
know how I can control the style / size of the gridExtra labels? 

library(gridExtra)
library(ggplot2)
dsamp <- diamonds[sample(nrow(diamonds), 1000), ] 

p1 <- qplot(carat, price, data=dsamp, colour=clarity)
p2 <- qplot(carat, price, data=dsamp, colour=clarity, geom="path")


tmp <- ggplot_gtable(ggplot_build(p1))
leg <- which(sapply(tmp$grobs, function(x) x$name) == "guide-box")
legend <- tmp$grobs[[leg]]

grid.arrange(arrangeGrob(p1 + theme(legend.position="none") +
ggtitle("Scatter Plot"),
                                        p2 + theme(legend.position="none") +
ggtitle("Line Plot"),
                                        main ="this is a title",
                                        left = "This is my global Y-axis
title"), legend, 
                     widths=unit.c(unit(1, "npc") - legend$width,
legend$width), nrow=1)





--
View this message in context: http://r.789695.n4.nabble.com/Styling-gridExtra-s-title-and-left-labels-tp4639388.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list