Herbert Jägle
unread,Jun 5, 2012, 4:50:28 PM6/5/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ggplot2
I am creating multiple plots which are adjusted with grid.arrange. An
example is given below.
The plot area size depends on the size of the axis labels so two plots
in a column are not adjusted.
Is it possible to set fixed size or adjust the size of the plot area?
Thanks,
Herbert
--------------------
df.d <- data.frame(x=c(1:10), y1=c(1:10)/10, y2=c(1:10)*10000)
label=y_label_formatter <- function(x) {lab <- sprintf('%5.0f', x)}
q <- ggplot(df.d) +
geom_point(aes(x, y1)) +
scale_x_continuous(name='x-axis', limits=c(0, 11)) +
scale_y_continuous(name='y1-axis', limits=c(0, 1.1),
label=y_label_formatter)
r <- ggplot(df.d) +
geom_point(aes(x, y2)) +
scale_x_continuous(name='', limits=c(0, 11)) +
scale_y_continuous(name='y2-axis', limits=c(0, 110000),
label=y_label_formatter)
theme_set(theme_bw())
plots.l <- list(ggplotGrob(r), ggplotGrob(q))
args.l <- c(plots.l, nrow=2, ncol=1)
do.call(grid.arrange, args.l)