使用grid.arrange在multiplot ggplot2中更改多行标题 [英] changing multiple line title in multiplot ggplot2 using grid.arrange

查看:230
本文介绍了使用grid.arrange在multiplot ggplot2中更改多行标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已按照讨论中的建议

使用grid.arrange在多图ggplot2中更改标题

但是我的2行标题不会更改字体大小.

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

1-我应该在grid.arrange中声明main还是在不使用main的情况下使用grid.arrange,然后添加以下脚本

1- should I state main in grid.arrange or do I use grid.arrange without main and then, add the following script

main=textGrob(paste("titleLine1", "titleLine2", sep = "\n"),gp=gpar(fontsize=20))

谢谢

Carol

推荐答案

这是一种可能性,

library(grid); library(gridExtra)
tg <- textGrob("Title Goes Here", gp=gpar(fontsize=30))
sg <- textGrob("more subtle subtitle ", gp=gpar(fontsize=15, fontface=3L))
margin <- unit(0.5, "line")
grid.newpage()
grid.arrange(tg, sg, rectGrob(), 
             heights = unit.c(grobHeight(tg) + 1.2*margin, 
                              grobHeight(sg) + margin, 
                              unit(1,"null")))

这篇关于使用grid.arrange在multiplot ggplot2中更改多行标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆