Closed brianpenghe closed 4 years ago
Can you elaborate? You can use sc.pl.violin
independently.
Can you elaborate? You can use
sc.pl.violin
independently.
OK I just updated my question and attached a sample image. What I want to do is split-violinplot.
Thanks for the update. Now is clear.
We do not offer that possibility as most of those functions are based on seaborn, thus, simply passing the relevant data to seaborn will get you the image that you want.
Nevertheless, I would like to take a look. How do you think this should work. Just add a variable to show the genes that you would like to see. Or you mean a more generic function just to make split plots between any two categories for the genes that you want to see?
Thanks for the update. Now is clear.
We do not offer that possibility as most of those functions are based on seaborn, thus, simply passing the relevant data to seaborn will get you the image that you want.
Nevertheless, I would like to take a look. How do you think this should work. Just add a variable to show the genes that you would like to see. Or you mean a more generic function just to make split plots between any two categories for the genes that you want to see?
Thanks for your attention. Yes it would be nice if I could compare two .obs categories with regard to expression distributions of a list of genes I supply.
Thanks!
This is a way to do it btw:
adata = sc.datasets.pbmc68k_reduced()
adata = adata[adata.obs.louvain.isin(['0','1'])].copy()
df = sc.get.obs_df(adata, ['PTPN7', 'SMAP2', 'PPDPF', 'louvain'])
df = df.set_index('louvain').stack().reset_index()
df.columns = ['louvain', 'gene', 'value']
import seaborn as sns
sns.violinplot(data=df, x='gene', y='value', hue="louvain",
split=True, inner="quart", linewidth=1)
Thank you very much!
This is a way to do it btw:
adata = sc.datasets.pbmc68k_reduced() adata = adata[adata.obs.louvain.isin(['0','1'])].copy() df = sc.get.obs_df(adata, ['PTPN7', 'SMAP2', 'PPDPF', 'louvain']) df = df.set_index('louvain').stack().reset_index() df.columns = ['louvain', 'gene', 'value'] import seaborn as sns sns.violinplot(data=df, x='gene', y='value', hue="louvain", split=True, inner="quart", linewidth=1)
Thanks for the suggestion! I am new to pthon. In your samples, you have '0' and '1' conditions in 'louvain'. But what if I have three conditions, How can I split the violin?
Best, Young
Hello, Currently only scanpy.pl.rank_genes_groups_violin can give us a split violin plot. But can we request a feature to allow us to do a split-violinplot of our own gene lists?
Thanks