This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How do I change the title font size in ViolinPlot (Seurat)

I was wondering how I can change the size of the title of the different columns of my violin plot?

When I use the FontSize(main = ) command it just change the last column, but not all.

This is my command

VlnPlot(
  object = seuObj,
  features = c("nCount_RNA", "nCount_ATAC", "TSS.enrichment", "nucleosome_signal"),
  ncol = 4,
  pt.size = 0.1 # , combine = TRUE
) +FontSize(main = 5)

and this is what I get:

ViolinPlot

How can I change the other three columns?

thx

seurat violin-plot ggplot2 patchwork

1 answer

Looking at the source code of the function it seems that they make individual plots with ggplot when features is > 1 and then use patchwork to stitch them. Hence, use patchwork functionality to apply standard ggplot manipulations.

Standard ggplot would be plot + theme(plot.title = element_text(size = 40, face = "bold")) and in patchwork it's plot & theme(plot.title = element_text(size = 40, face = "bold")). Mind the & rather than +. You need to run library(patcwork) of course fist.

Wondering why after almost 13 years in this community you cannot figure these sorts of things out yourself... not up to a little detective challenge here and there? It's fun.

thx for the explanation.

I did look at the function and I also read in the help page, that you get a patchwork object, only when using combine = TRUE.

I also can't see in the function script, where they look at how many features I input.

wow this ampersand hack is crazy, thank you! I've been in the R field since 2015 and didn't know this thing

Log in to answer this question.