-
Notifications
You must be signed in to change notification settings - Fork 709
Open
Labels
Description
Hi,
I created scatterplots for quality control and want to show them side-by-side to save some space.
I tried it using subplots, but this is what happens:
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(15, 5))
p1 = sc.pl.scatter(adata, x='n_counts', y='n_genes', color='n_genes', show=False, ax=ax1)
p2 = sc.pl.scatter(adata[adata.obs['n_counts'] < 10000], x='n_counts', y='n_genes', color='n_genes', show=False, ax=ax2)The problem seems to be that pl.scatter adds an additional axes of that subplots doesn't know anything. Is there an easy fix for that?
Versions
scanpy==1.4.4 anndata==0.6.22.post1 umap==0.3.10 numpy==1.17.1 scipy==1.3.1 pandas==0.25.1 scikit-learn==0.21.3 statsmodels==0.10.1 python-igraph==0.7.1 louvain==0.6.1
Full repex
import scanpy as sc
import numpy as np
from matplotlib import pyplot as plt
adata = sc.read_h5ad("data/pbmc3k_raw.h5ad")
adata.obs['n_counts'] = adata.X.sum(axis=1)
adata.obs['n_genes'] = (adata.X != 0).sum(axis=1)
# show plots below each other (standard, works)
p1 = sc.pl.scatter(adata, x='n_counts', y='n_genes', color='n_genes', show=False)
p2 = sc.pl.scatter(adata[adata.obs['n_counts'] < 10000], x='n_counts', y='n_genes', color='n_genes', show=False)
# try to show plots side-by-side (looks weird)
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(15, 5))
p1 = sc.pl.scatter(adata, x='n_counts', y='n_genes', color='n_genes', show=False, ax=ax1)
p2 = sc.pl.scatter(adata[adata.obs['n_counts'] < 10000], x='n_counts', y='n_genes', color='n_genes', show=False, ax=ax2)Reactions are currently unavailable
