How do I change the title font size in ViolinPlot (Seurat)
1
0
Entering edit mode
16 months ago
Assa Yeroslaviz ★ 1.9k

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 • 2.7k views
ADD COMMENT
3
Entering edit mode
16 months ago
ATpoint 89k

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.

ADD COMMENT
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 4314 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6