I am creating a multi plot in R using grid.arrange
, and wanted to change my title so that it is bold (and italic if possible).
As this is a general question, I will not include the code for my plots, but the code I am using to make my multi plot is:
grid.arrange(g1, g3, g4+theme(legend.position="none"),mylegend, top="Test title",
layout_matrix=matrix(c(1,1,2,3,4,4), ncol=2, byrow=TRUE),heights=c(1,1.5,0.3))
Are there any additional arguments which can be passed to the top
argument to change the font face?
I've worked it out myself..
You can use the text_grob function to create a text element, which can then be passed to the top
function of grid.arrange
.
For example,
##title1=textGrob("Test title", gp=gpar(fontface="bold")) ## this does not work anymore
title1=text_grob(main, size = 15, face = "bold") #### this worked for me
grid.arrange(g1, g3, g4+theme(legend.position="none"),mylegend, top=title1, ncol=2, byrow=TRUE),heights=c(1,1.5,0.3))
Just a small update:
Instead of using text
textGrob
use text_grob
from ggpubr
package
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With