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

Stacked barplot #2873

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Stacked barplot #2873

wants to merge 4 commits into from

Conversation

mbernste
Copy link

  • [ X] Closes # (New Feature)
  • [ X] Tests included or not required because:
  • [X ] Release notes not necessary because:

I thought I would give a shot at contributing to this awesome tool! I added a function to Scanpy's plotting API that I use in my own research for creating stacked barplots for visualizing compositions of cell groups. An example is depicted below:

image

Specifically, this function enables one to plot the fraction of each cell group (e.g., cluster) that are labelled with a specific categorical variable. For example, if the cell groups are clusters, then one might be interested in examining the fraction of each cluster that originates from each "batch" of cells or each patient sample.

This function also enables ordering of the groups according to a specific value (e.g., a patient number or batch ID) or by agglomerative clustering. An example of ordering the groups based on agglomerative clustering is shown below:

image

The function supplies an argument to specify whether the dendrogram should or should not be plotted.

Please let me know if this feature is of interest and if so, what else needs to be adjusted or fixed prior to merging. Thanks!

Matt

Copy link

codecov bot commented Feb 20, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 74.76%. Comparing base (14555ba) to head (626d389).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2873      +/-   ##
==========================================
- Coverage   74.82%   74.76%   -0.07%     
==========================================
  Files         116      117       +1     
  Lines       12809    12893      +84     
==========================================
+ Hits         9584     9639      +55     
- Misses       3225     3254      +29     
Files Coverage Δ
scanpy/plotting/__init__.py 100.00% <100.00%> (ø)
scanpy/plotting/_stacked_barplot.py 85.54% <85.54%> (ø)

... and 8 files with indirect coverage changes

@ivirshup ivirshup self-requested a review April 18, 2024 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant