✓ Scanpy and AnnData are available
Load Example Dataset¶
We'll use the PBMC3k dataset, a standard example in single-cell analysis that contains ~3000 peripheral blood mononuclear cells.
Dataset shape: (2638, 1838) Available observations: ['n_genes', 'percent_mito', 'n_counts', 'louvain'] Cell type distribution: louvain CD4 T cells 1144 CD14+ Monocytes 480 B cells 342 CD8 T cells 316 NK cells 154 FCGR3A+ Monocytes 150 Dendritic cells 37 Megakaryocytes 15 Name: count, dtype: int64
Clean UMAP Visualization¶
The clean_umap() function creates beautiful, publication-ready UMAP plots with:
- Minimal decorations (no borders, ticks, or frame)
- Custom L-shaped axis indicators with arrowheads
- Automatically ejected legend to the right side
- Shuffled cells to avoid non-random ordering artifacts
Basic Usage - Cell Type Coloring¶
<Figure size 1000x800 with 0 Axes>
Gene Expression Visualization¶
You can also color cells by gene expression levels:
Customizing Axis Indicators¶
You can customize the appearance of the axis indicators:
Comparison: Standard vs Clean UMAP¶
Let's compare the standard Scanpy UMAP with BuenColors' clean version:
Using BuenColors Palettes with UMAPs¶
You can combine clean_umap() with BuenColors' beautiful color palettes:
<Figure size 1000x800 with 0 Axes>
Multiple Color Variables¶
Create a multi-panel figure showing different aspects of your data:
Combining with Pretty Plot Style¶
For even better-looking plots, combine clean_umap() with the BuenColors pretty-plot style:
<Figure size 2500x2000 with 0 Axes>
Summary¶
The clean_umap() function provides:
- Minimal decorations - Clean, publication-ready plots without unnecessary visual clutter
- Custom axis indicators - Professional L-shaped axes with arrowheads
- Auto-ejected legends - Legends placed outside the plot area to avoid obscuring data
- Cell shuffling - Automatic randomization to prevent ordering artifacts
- Full customization - Compatible with all Scanpy UMAP parameters
Parameters¶
adata: AnnData object containing UMAP coordinatescolor: Column in adata.obs or gene name for coloringax: Optional matplotlib axis (if None, creates new)axis_len: Length of axis indicators (default: 0.2)thickness: Line width of axis indicators (default: 3.0)**kwargs: Additional arguments passed tosc.pl.umap()
Compatibility¶
Requires:
anndata- for AnnData objectsscanpy- for UMAP plottingmatplotlib- for plotting (already a BuenColors dependency)