Change the style of the grid.arrange header. Bold, italic, etc. R

I am creating a multidimensional graph in R using grid.arrange , and wanted to change my title so that it is bold (and, if possible, italic).

Since this is a general question, I will not include code for my stories, but the code that I use to make my multi-graph:

 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 that can be passed to the top argument to change the font face?

+5
source share
1 answer

I have dealt with this myself.

You can use the textGrob function to create a text element that can then be passed to the top grid.arrange function.

For instance,

 title1=textGrob("Test title", gp=gpar(fontface="bold")) grid.arrange(g1, g3, g4+theme(legend.position="none"),mylegend, top=title1, layout_matrix=matrix(c(1,1,2,3,4,4), ncol=2, byrow=TRUE),heights=c(1,1.5,0.3)) 

This trick is beautiful.

+6
source

Source: https://habr.com/ru/post/1245079/


All Articles