Skip to content

Commit 10f9956

Browse files
committed
update readme, add new functions
1 parent aa555b7 commit 10f9956

16 files changed

Lines changed: 8058 additions & 1159 deletions

README.md

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,32 @@
55
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
66
[![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](pyproject.toml)
77

8-
**scplotkit** is a publication-ready plotting toolkit for single-cell atlas
9-
analysis, built on top of [scanpy](https://scanpy.readthedocs.io) and
10-
[AnnData](https://anndata.readthedocs.io). It focuses on the figures that
11-
don't ship out of the box with scanpy: masked/highlighted embeddings,
12-
multi-view compositional bar plots and heatmaps, dataset overview panels, and
13-
Sankey diagrams over annotation hierarchies — all styled consistently and
14-
saved to disk with one call.
15-
16-
- **scanpy-native** — works directly on `AnnData` objects, no intermediate data wrangling.
17-
- **Consistent styling** — a single `PlotConfig` controls fonts, DPI, and color palettes across every plot.
18-
- **No hidden assumptions** — column names, palettes, and grouping variables are always explicit arguments; sensible colors are auto-generated when you don't supply a palette.
19-
- **Two APIs** — a functional, scanpy-style API (`scplotkit.composition.stacked_barplots(...)`) and a stateful convenience class (`scplotkit.ScPlotter`) for when you're producing many figures against the same config/output directory.
8+
This is just a pile of plotting functions I kept rewriting from scratch for
9+
every single-cell project, finally bundled up so I stop copy-pasting them
10+
between notebooks. Built on top of [scanpy](https://scanpy.readthedocs.io) and
11+
[AnnData](https://anndata.readthedocs.io) — masked/highlighted UMAPs,
12+
composition bar plots and heatmaps, pseudobulk boxplots, marker gene panels,
13+
Sankeys/sunbursts/treemaps over annotation hierarchies, that kind of thing.
14+
Nothing statistical happening here, no new analysis — it's purely "make the
15+
plot I already know I want, and make it look the same every time."
16+
17+
Not trying to be *the* single-cell plotting library, it's just what's in my
18+
toolbox. If you've got a plot you always reach for that isn't in here, please
19+
open a PR — genuinely happy to have other people's favorite ways of looking at
20+
single-cell (and maybe eventually spatial) data in here too. See
21+
[Contributing](#contributing) below.
22+
23+
- **scanpy-native** — works directly on `AnnData` objects, no wrangling in between.
24+
- **One config, every plot** — a single `PlotConfig` controls fonts, DPI, and color palettes, so figures don't end up looking like they came from six different notebooks.
25+
- **Explicit over magic** — column names, palettes, and grouping variables are always arguments you pass in; if you don't give a palette, a colorblind-friendly one gets generated for you.
26+
- **Two ways to call it** — plain functions (`scplotkit.composition.stacked_barplots(...)`) if you like the scanpy-style API, or `scplotkit.ScPlotter` if you're making a bunch of figures and don't want to pass `config`/`output_dir` every single time.
2027

2128
## Installation
2229

2330
```bash
2431
pip install scplotkit
2532

26-
# optional: Sankey diagrams (requires plotly + kaleido)
33+
# optional: Sankey/sunburst/treemap plots (needs plotly + kaleido)
2734
pip install "scplotkit[sankey]"
2835
```
2936

@@ -79,14 +86,14 @@ composition.stacked_barplots(adata, level_column="cell_type", sample_column="sam
7986

8087
| Module | Plots |
8188
| --- | --- |
82-
| `scplotkit.embeddings` | Masked UMAP, highlighted UMAP overlays, gene expression on an embedding (masked or full) |
83-
| `scplotkit.composition` | Stacked composition bar plots (basic / clustered / grouped-clustered), multi-metadata variant, clustered composition heatmap |
84-
| `scplotkit.overview` | Samples/cells-per-category bar plots (incl. broken-axis), cells-per-patient boxplot, cell abundance bar plots, dataset-vs-dataset comparison (bars and paired boxplots) |
85-
| `scplotkit.markers` | Rank-genes-groups dot/matrix plots, custom marker-set matrix and stacked-violin plots, gene-panel expression heatmap with optional z-scoring and dendrograms |
86-
| `scplotkit.pseudobulk` | Per-sample pseudobulk boxplot for one gene, min-max-scaled multi-gene boxplot |
87-
| `scplotkit.ridgeline` | Ridgeline (joy) plots of a continuous value across groups, with optional per-condition overlay |
88-
| `scplotkit.enrichment` | Dot plot overview of over-representation analysis (ORA) results, e.g. from Enrichr/gseapy |
89-
| `scplotkit.sankey` | Sankey diagrams across 1-3 nested annotation levels |
89+
| `scplotkit.embeddings` | Masked UMAP, masked-and-highlighted UMAP overlay, gene expression on an embedding, two-gene co-expression color blend, per-group embedding density |
90+
| `scplotkit.composition` | Stacked composition bar plots (plain / clustered / clustered-within-group), a multi-metadata variant with color strips, a clustered composition heatmap, a cell-count bubble grid |
91+
| `scplotkit.overview` | Samples/cells-per-category bar plots (incl. broken-axis), cells-per-patient boxplot, cell abundance bar plots, dataset-vs-dataset comparisons (bars and paired boxplots) |
92+
| `scplotkit.markers` | `rank_genes_groups` dot/matrix plots, plus matrix and stacked-violin plots for your own marker gene sets |
93+
| `scplotkit.pseudobulk` | Per-sample pseudobulk boxplot for one gene, or several at once (optionally min-max scaled) |
94+
| `scplotkit.ridgeline` | Ridgeline (joy) plots of a continuous value across groups, with an optional per-condition overlay |
95+
| `scplotkit.enrichment` | Dot plot for over-representation analysis (ORA) results, e.g. from Enrichr/gseapy |
96+
| `scplotkit.sankey` | Sankeys, sunbursts, and treemaps over 1-3 nested annotation levels |
9097

9198
## Configuration
9299

@@ -112,16 +119,23 @@ value up front.
112119

113120
## Documentation & tutorial
114121

115-
Full API reference and a runnable tutorial (built on scanpy's public pbmc3k
116-
dataset) are in [`docs/`](docs/) and published at
117-
https://scplotkit.readthedocs.io. To build the docs locally:
122+
Full API reference and a runnable tutorial (on a real published atlas) live
123+
in [`docs/`](docs/) and are published at https://scplotkit.readthedocs.io. To
124+
build the docs locally:
118125

119126
```bash
120127
pip install -e ".[docs]"
121128
sphinx-build -b html docs docs/_build/html
122129
```
123130

124-
## Development
131+
## Contributing
132+
133+
Got a plot you always end up making for single-cell (or spatial) data? Open a
134+
PR. No formal process here — just try to match the existing style (one
135+
function per plot, `config`/`output_dir` as the last two args, save via
136+
`save_figure` so it lands in the same place as everything else) and add it to
137+
`__all__` and the table above. Bug reports and "this default looks bad"
138+
complaints are just as welcome as new plots.
125139

126140
```bash
127141
pip install -e ".[dev]"

docs/index.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# scplotkit
22

3-
Publication-ready plotting for single-cell atlas analysis, built on top of
4-
[scanpy](https://scanpy.readthedocs.io) and [AnnData](https://anndata.readthedocs.io).
3+
A pile of plotting functions for single-cell analysis, built on top of
4+
[scanpy](https://scanpy.readthedocs.io) and [AnnData](https://anndata.readthedocs.io),
5+
bundled up so they don't have to be rewritten for every new project.
56

6-
scplotkit fills in the figures scanpy doesn't ship out of the box: masked and
7-
highlighted embeddings, multi-view compositional bar plots and heatmaps,
8-
dataset overview panels, marker-gene matrix/violin plots, and Sankey diagrams
9-
over annotation hierarchies — all styled consistently through a single
10-
{class}`~scplotkit.PlotConfig` and saved to disk with one call.
7+
Masked and highlighted embeddings, gene co-expression blends, compositional
8+
bar plots and heatmaps, dataset overview panels, marker-gene matrix/violin
9+
plots, Sankeys/sunbursts/treemaps over annotation hierarchies — all styled
10+
consistently through a single {class}`~scplotkit.PlotConfig` and saved to disk
11+
with one call. Nothing statistical, no new analysis, just the plots. PRs for
12+
your own favorite single-cell (or spatial) plots are very welcome.
1113

1214
```{toctree}
1315
:maxdepth: 2
@@ -31,5 +33,5 @@ plotter.masked_umap(adata, color_by="cell_type", mask_values=["CD4 T", "CD8 T"],
3133
plotter.stacked_barplots(adata, level_column="cell_type", sample_column="sample_id")
3234
```
3335

34-
See the {doc}`tutorial/tutorial` for a full walkthrough on a public dataset,
35-
or the {doc}`api` for the complete function reference.
36+
See the {doc}`tutorial/tutorial` for a full walkthrough on a real published
37+
atlas, or the {doc}`api` for the complete function reference.

0 commit comments

Comments
 (0)