scanpy icon indicating copy to clipboard operation
scanpy copied to clipboard

Issue about plot stackedviolin.

Open UboCA opened this issue 2 years ago • 1 comments

  • [√ ] Additional function parameters / changed functionality / changed defaults?
  • [ ] New analysis tool: A simple analysis tool you have been using and are missing in sc.tools?
  • [ ] New plotting function: A kind of plot you would like to seein sc.pl?
  • [ ] External tools: Do you know an existing package that should go into sc.external.*?
  • [ √] Other?

Hi, when I used stacked violin to plot gene expression among groups on UMI levels, I was confused about the color bar about it. In detail you can see the following picture I got.

image

Like legend description 'Median expression in group', I guess the color palette is related about umi count value after scaling them among different groups (X-axis)? I'm not sure about the meaning of the color map.

Similar to Seurat displaying way like image

How can I get similar plot by sc.pl.stacked_violin, and plot umi distribution only, without color map?

Any direction would be appreciated, thanks :)

UboCA avatar Jul 23 '22 15:07 UboCA

Is it useful to change parameter including 'standard_scale' or norm?

UboCA avatar Jul 23 '22 15:07 UboCA

Hi @UboCA,

You can use the row_palette argument for this, as in this example:

import scanpy as sc
adata = sc.datasets.pbmc3k_processed()
sc.pl.stacked_violin(
    adata,
    var_names=["PTPRC", "RER1"],
    groupby="louvain",
    row_palette="tab10",
    # swap_axes=True,
)

Which gives: Screenshot 2022-09-24 at 17 43 01

If you want to color by gene instead of by group, you can use the swap_axes argument.

LisaSikkema avatar Sep 24 '22 15:09 LisaSikkema

Got it, many thanks!

UboCA avatar Sep 25 '22 09:09 UboCA

Hi @UboCA,

You can use the row_palette argument for this, as in this example:

import scanpy as sc
adata = sc.datasets.pbmc3k_processed()
sc.pl.stacked_violin(
    adata,
    var_names=["PTPRC", "RER1"],
    groupby="louvain",
    row_palette="tab10",
    # swap_axes=True,
)

Which gives: Screenshot 2022-09-24 at 17 43 01

If you want to color by gene instead of by group, you can use the swap_axes argument.

Hi,

I solved the issue of inputting specific colors with the row_palette argument, but when using swap_axes to have the same plot as in Seurat (bottom image), it colors genes instead clusters as you mention. Is there any way to input the palette list by columns instead of by rows?

image

barbareyex avatar May 18 '23 11:05 barbareyex