changing multiple line title in multiplot ggplot2 using grid.arrange

前端 未结 3 1893
余生分开走
余生分开走 2020-12-19 21:22

I have followed the advice on the discussion

changing title in multiplot ggplot2 using grid.arrange

but my 2-line title doesn\'t change the font size.

3条回答
  •  一生所求
    2020-12-19 22:01

    You could go in a different direction and use ggplot2 latest build from github:

    library(ggplot2) # (github version) devtools::install_github("hadley/ggplot2")
    
    p <-  ggplot(cars, aes(x=speed, y=dist))
    p <- p + theme_bw()
    p <- p + geom_bar(fill="blue", stat="identity")
    p <- p + labs(title="Fast Cars",
                  subtitle="Are more Fun")
    p <- p + theme(axis.text.x=element_text(angle=90, hjust=0, vjust=1)) 
    p <- p + theme(plot.title=element_text(size=30, hjust=0.5, face="bold", colour="darkgreen", vjust=-1))
    p <- p + theme(plot.subtitle=element_text(size=20, hjust=0.5, face="italic", color="darkred"))
    p
    

    This was added pretty recently here: https://github.com/hadley/ggplot2/pull/1582

    let me know if it works!

提交回复
热议问题