Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requesting ncols parameter in sc.pl.violin() #1552

Open
rpeys opened this issue Dec 20, 2020 · 6 comments
Open

requesting ncols parameter in sc.pl.violin() #1552

rpeys opened this issue Dec 20, 2020 · 6 comments
Assignees
Labels
Area - Plotting 🌺 good first issue easy first issue to get started in OSS community contribution!

Comments

@rpeys
Copy link

rpeys commented Dec 20, 2020

It would be nice to have a way to split the violin plots from sc.pl.violin() into a specific number of rows, similar to the ncols parameter in scanpy.pl.umap()

@gokceneraslan gokceneraslan added good first issue easy first issue to get started in OSS community contribution! Area - Plotting 🌺 labels Dec 20, 2020
@fidelram fidelram self-assigned this Jan 12, 2021
@divyanshusrivastava
Copy link

Any news on this ??

@julie-jch
Copy link

Also looking forward to this update

@SNOL2
Copy link

SNOL2 commented Feb 19, 2023

Looking forward to this update or is there any other way to achieve this?

@SandyChenn
Copy link

It seems that the question has not be addressed yet, and still can't find the ncols parameter alike.

@flying-sheep
Copy link
Member

flying-sheep commented Apr 29, 2024

Pull requests welcome! You can achieve this e.g. like this:

import itertools
import math

import matplotlib.figure

import scanpy as sc


# parameters
ad = sc.datasets.pbmc68k_reduced()
vars = ["n_genes", "percent_mito", "n_counts", "S_score", "G2M_score"]
n_cols = 3

# plotting code
n_rows = math.ceil(len(vars) / n_cols)
fig = matplotlib.figure.Figure()
axs = fig.subplots(n_rows, 1)
for ax, v in zip(axs.flat, itertools.batched(vars, n_cols)):
    sc.pl.violin(ad, v, ax=ax)
fig

@imnuvi
Copy link

imnuvi commented Dec 19, 2024

Hi!
Can I work on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area - Plotting 🌺 good first issue easy first issue to get started in OSS community contribution!
Projects
None yet
Development

No branches or pull requests

9 participants