我想将从下面的循环中生成的 tsnes 放在一起:
import scanpy as sc
import seaborn as sns
import matplotlib.pyplot as plt
# Subset the data by condition
conditions = adata_all.obs['condition'].unique()
# Create a grid of subplots with 1 row and 3 columns
fig, axes = plt.subplots(1, 3, figsize=(12, 4), sharex=True, sharey=True)
for i, condition in enumerate(conditions):
adata_sub = adata_all[adata_all.obs['condition'] == condition]
# Run t-SNE
sc.tl.tsne(adata_sub)
# Plot t-SNE with LNP color and condition facet in the appropriate subplot
sc.pl.tsne(adata_sub, color='CD11b', palette=cmap, title=condition, ncols=1, ax=axes[i])
# Save the figure
plt.savefig('tsne_plots.png', dpi=300)
我有三个条件,像这样
conditions: ['AB', 'AC', 'AD']
Categories (3, object): ['AB', 'AC', 'AD'].
但在输出中只绘制了第一个 tsne,最后两个是空图。有什么问题吗?