Which property, if any, in ggplot
controls
the width (or amount of blank space) of the axis text?
In the example below, my ultimate goal is to "push in" the left-hand side of the top graph so that it lines up with the bottom graph.
I tried theme(plot.margin=..)
but that affects the margin of the entire plot.
facet
'ing doesn't help either, since the scales on the y are different.
As a last resort, I realize I could modify the axis text itself, but then I would also need to calculate the cuts for each graph.
Reproducible Example:
library(ggplot2)
library(scales)
D <- data.frame(x=LETTERS[1:5], y1=1:5, y2=1:5 * 10^6)
P.base <- ggplot(data=D, aes(x=x)) +
scale_y_continuous(labels=comma)
Plots <- list(
short = P.base + geom_bar(aes(y=y1), stat="identity", width=.5)
, long = P.base + geom_bar(aes(y=y2), stat="identity", width=.5)
)
do.call(grid.arrange, c(Plots, ncol=1, main="Sample Plots"))