Footnotes with arrangeGrob

124 views
Skip to first unread message

Tine Casneuf

unread,
Sep 1, 2015, 2:58:01 PM9/1/15
to ggplot2
Hey guys,

I used to be able to add footnotes to ggplot plots with the code below. Since some recent updates (also discussed in http://comments.gmane.org/gmane.comp.lang.r.ggplot2/10941), the output figure is rescaled, i.e. it seems like the graph itself looks to be only 1/2 of the height, and the footnote the other 1/2. 

Any thoughts of why the rescaling is happening? 

library(ggplot2)
library(gridExtra)
library(grid)
toyota <- mpg[which(mpg$manufacturer == 'toyota'), ]
p <- ggplot(toyota, aes(displ, hwy)) + facet_wrap(~ class, ncol = 2) + geom_point(aes(size=cyl))
print(p)
g <- arrangeGrob(p, sub = textGrob("Footnote", x = 0, hjust = -0.1, vjust=0.1, gp = gpar(fontface = "italic", fontsize = 10)))
ggsave("./plot_grid_extra.png", g)

Thanks!
tine

---

> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] gridExtra_2.0.0    ggplot2_1.0.1.9003

loaded via a namespace (and not attached):
[1] colorspace_1.2-6 digest_0.6.8     gtable_0.1.2     labeling_0.3     munsell_0.4.2    plyr_1.8.3       Rcpp_0.12.0      scales_0.3.0     tools_3.1.2     


Reply all
Reply to author
Forward
0 new messages