简体   繁体   中英

gridExtra “main” and “sub” parameters no longer recognized after upgrading to Version 2.0.0

I recently updated gridExtra to Version 2.0.0, which was released July 14, 2015. It appears that the arguments "main" and "sub" are no longer recognized as the following code now places the two textGrobs into their own panels, ie previously there were four panels containing graphs sandwiched between a title section ("main") and a subtitle section ("sub"). Now there are 6 panels with the last two containing the text from "main" and "sub".

Is it possible to get the previous functionality back? If so, how? Thank you.

library(ggplot2)
library(gridExtra)

graphA = ggplot(data.frame(x=rnorm(100), y=rnorm(100)), aes(x=x, y=y)) + geom_line()
graphB = ggplot(data.frame(x=rnorm(100), y=rnorm(100)), aes(x=x, y=y)) + geom_line()
graphC = ggplot(data.frame(x=rnorm(100), y=rnorm(100)), aes(x=x, y=y)) + geom_line()
graphD = ggplot(data.frame(x=rnorm(100), y=rnorm(100)), aes(x=x, y=y)) + geom_line()

grid.arrange(graphA, graphB, graphC, graphD, ncol=2, 
         main = textGrob("Title", gp=gpar(fontsize=20,font=3)), 
         sub = textGrob("Subtitle")
)

现在应该使用“ top”和“ bottom”代替“ main”和“ sub”。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM