Skip to content

Composition barplots

The Barplot tab draws a stacked barplot: one bar per category of one .obs column, split by the categories of a second. It answers "what is each group made of?": clusters by territory, clusters by section, cell type by sample.

Where to find it

The Barplot tab above the plot. Columns… in its toolbar opens the Stacked barplot settings.

How it works

Skopia cross-tabulates the two columns over the cells in scope: for each category of the first column (a bar), it counts the cells carrying each category of the second (a segment). Only categorical, string and boolean columns are offered; a continuous column has no categories to stack. Segment colors come from uns['<column>_colors'] when the dataset has them (scanpy's convention), otherwise from Skopia's palette, so the barplot matches the Embedding's colors.

The barplot honors the cell mask. With a mask active, only the cells inside it are counted, and the toolbar says how many, for example 300 of 1,000 cells (mask). Reset Mask counts every cell again. See Select, mask and delete.

Run it

  1. Open the Barplot tab and click Columns….
  2. Under One bar per, choose the column whose categories become the bars.
  3. Under Split each bar by, choose the column whose categories stack inside each bar. It must differ from the first.
  4. Set the options below and click Plot.

Hover a segment to see its count and share, for example 3 · epidermis: 412 cells (27.5%). The legend sits in a floating panel you can move.

Parameters

Parameter Default What it does
One bar per none Column A: one bar per category.
Split each bar by none Column B: the segments within each bar.
Bar height Proportion Proportion makes every bar the same height, so composition is comparable across groups of very different sizes. Cell count keeps the group sizes visible instead.
Order bars The dataset's order The dataset's order (as the column stores its categories), By name (numeric-aware, so 9 comes before 10), By size (largest group first), or By composition.
Most of none Only with By composition: the category of column B to sort by, bars with the largest share of it first. The categories come from the data, so plot the two columns once before choosing.
Hide bars under 0 cells Leaves out bars with fewer cells. The toolbar notes how many bars were hidden.
Label each bar with its cell count off Writes each bar's cell count on the plot.

Hide small groups

A group of three cells has a composition, but not one worth reading. Raise Hide bars under before comparing proportions, especially under Proportion, where a tiny group draws as tall as a large one.

Export and save

  • Export SVG downloads the plot as it is drawn.
  • Save as figure keeps the plot as a composition_barplot figure record and opens the Figures tab, where you can edit its parameters with a live preview, export it as SVG or PNG, and attach it to the analysis record. The record stores the two columns, the options, and the cells it was drawn on: the active named subset by name, or the masked cells' indices when the mask is not a saved subset.

What it writes

The tab itself writes nothing. Save as figure adds one entry to uns['skopia_figures'] (see the Figures tab).