Seurat: group coloring switches sides in VlnPlot with split.by

Created on 19 Aug 2019  路  7Comments  路  Source: satijalab/seurat

Hello,
I am running the dev version. Below is my command to make a Violin plot split by a grouping variable:
VlnPlot(object = obj, features = "gene1", split.by = "group", assay="RNA", pt.size=0.5)
Strangely, group1(red) is initially plotted on the left side but switched to the right side in the same graph. An example is attached. Thank you.
example

bug

Most helpful comment

Moreover, cells belonging to goup1 of "Inh", which should have been plotted on the left side only, are now distributed across the entire "Inh" column, which can be misleading.

I think this is a general "bug". I also noticed that, when you use split.by, the violins are split, but the points are still allover. This can be especially misleading, when you don't have enough cells in the cluster expressing the respective gene.

vlnplot_black

I used the following code to show that the points are allover:
VlnPlot(seurat.object, features = genes[2], split.by = "condition")+aes(color=seurat.object$condition)

vln_plot_col

If the dots are all black, in condition 2 in this plot, you would expext that more ore less the same amount of cells is expressing this gene, at more or less the same level. But when coloring the dots, it becomes clear that these are actually expressed at very different levels in the two conditions.

Is there a possibility to plot the dots of each condition only to the side of that condition when using the split.by argument?

All 7 comments

Hi,

This is strange. Does the switching persist if you remove the empty identity ("Lym")?

Hi Andrew,

I removed "Lym" identity and the VlnPlot worked properly now. Note the "Lym" identity is not totally empty--there's one cell in one of the two groups. To further test this, I removed all cells in group2 (green) of "Inh", and it caused color switching again. Moreover, cells belonging to goup1 of "Inh", which should have been plotted on the left side only, are now distributed across the entire "Inh" column, which can be misleading. I'd appreciate your help to fix the bug. Thank you.
image

Moreover, cells belonging to goup1 of "Inh", which should have been plotted on the left side only, are now distributed across the entire "Inh" column, which can be misleading.

I think this is a general "bug". I also noticed that, when you use split.by, the violins are split, but the points are still allover. This can be especially misleading, when you don't have enough cells in the cluster expressing the respective gene.

vlnplot_black

I used the following code to show that the points are allover:
VlnPlot(seurat.object, features = genes[2], split.by = "condition")+aes(color=seurat.object$condition)

vln_plot_col

If the dots are all black, in condition 2 in this plot, you would expext that more ore less the same amount of cells is expressing this gene, at more or less the same level. But when coloring the dots, it becomes clear that these are actually expressed at very different levels in the two conditions.

Is there a possibility to plot the dots of each condition only to the side of that condition when using the split.by argument?

I just realized that with the above mentioned code

VlnPlot(seurat.object, features = genes[2], split.by = "condition")+aes(color=seurat.object$condition)

the coloring again switches sides in each group.

Screenshot 2019-12-06 at 15 21 58

Thanks for reporting this, it will be fixed in the next release.

This is now fixed on the develop branch

This still seems not fixed. I am opening a new issue.

Was this page helpful?
0 / 5 - 0 ratings