I have the following R ggplot code:
require(ggplot2)
require(ggthemes)
df <- data.frame(x=1:10, y=5*(1:10))
p <- ggplot(df, aes(x,y)) +
geom_point() +
theme_few() +
theme(plot.background = element_rect(fill='transparent', colour=NA), legend.position='top')
pdf('test.pdf', width=5, height=2)
plot(p)
plot(ggplot_gtable(ggplot_build(p)))
But I do get two different figures:
I like the first figure (i.e without the background grid outside panel area). However, I also need to use ggplot_build() for some other processing. Could you please help?