0

我正在使用 scanpy 分析一些数据,我正在尝试将 3 个小提琴图并排绘制,但我似乎无法让它工作。我尝试了几种不同的方式使用子图,但他们不断得到空白图表,它们之间有小提琴图。我尝试了几种不同的策略,但我似乎无法让它们在 1x3 网格中彼此相邻。下面是我的最新尝试以及部分情节,其中显示了一个堆叠在小提琴情节之上的空情节。

plt.figure()
plt.subplot(1,3,1)
sc.pl.violin(visium, keys = 'n_genes_by_counts')
plt.subplot(1,3,2)
sc.pl.violin(visium, keys = 'total_counts')
plt.subplot(1,3,3)
sc.pl.violin(visium, keys = 'pct_counts_mt')

样本

在此处输入图像描述

4

2 回答 2

2

尝试设置multi_panel = True

像这样:

sc.pl.violin(visium, ['n_genes_by_counts','total_counts','pct_counts_mt'],
             jitter=0.3, multi_panel=True)
于 2021-01-04T14:22:06.947 回答
0

Either use the flag multi_panel = True in sc.pl.violin, or the ax flag:

plt.figure()
ax1 = plt.subplot(1,3,1)
sc.pl.violin(visium, keys = 'n_genes_by_counts', ax = ax1)
ax2 = plt.subplot(1,3,2)
sc.pl.violin(visium, keys = 'total_counts', ax = ax2)
ax3 = plt.subplot(1,3,3)
sc.pl.violin(visium, keys = 'pct_counts_mt', ax = ax3)
于 2021-10-04T15:14:14.603 回答