The Figures tab¶
The Figures tab holds saved figures as records you can edit, export and attach to the analysis record. A figure is stored as data and a specification, not as pixels, so a saved .h5ad re-renders every figure when it is opened again, and the exported notebook can regenerate each one.
Where to find it
The Figures tab above the plot. Figures are created from the tools that make them (Save as figure in the Expression and Barplot tabs, Heatmap figure… in the Enrichment and CNV tools, Save in Panels) or with New figure… in the tab.
How it works¶
A figure record has four parts:
- a kind (what is drawn),
- inputs: the stored results it is built from, such as an enrichment run's key, a marker run, an
.obscolumn, gene sets, or the cells, - params: the display choices, such as ordering, thresholds and colors,
- provenance: which analysis-record steps produced the inputs, and which step created the figure.
The records live in uns['skopia_figures']. The plotted table is a backend function of the record (xa.figure_data("fig_3") in the Python API), and the browser draws it. Figure ids (fig_1, fig_2, …) come from a counter that survives deletion, so fig_3 never silently refers to a different figure later.
Each figure records the identity of the runs it reads. If an input is deleted or re-made (a marker run re-run under the same key, an enrichment result deleted, a group label renamed away), the figure stays listed and says which input is missing instead of drawing something else. The figure spec is kept so its provenance is not lost; re-run the analysis it points at to draw it again.
Figure kinds¶
| Kind | Shown as | Made from | Exports |
|---|---|---|---|
enrichment_heatmap |
Enrichment heatmap | Heatmap figure… on an enrichment result, or New figure… | SVG, PNG |
enrichment_network |
Enrichment network | Network figure… on an enrichment result, or New figure… | SVG, PNG |
composition_barplot |
Composition barplot | Save as figure in the Barplot tab | SVG, PNG |
expression_heatmap |
Expression heatmap | Save as figure in the Expression tab (heatmap) | PNG only (drawn on a canvas) |
expression_dotplot |
Dot plot | Save as figure in the Expression tab (dot plot) | SVG, PNG |
cnv_heatmap |
CNV heatmap | Heatmap figure… in the copy-number tool | PNG |
embedding_panels |
Panels | Save in the Panels tab | Open it in Panels to export |
New figure… creates the two enrichment kinds from a stored enrichment result; the other kinds are made from their own tabs and tools.
Enrichment heatmap¶
Gene sets × groups. With a batch enrichment over a column (one contrast per cluster), each column is a group. Cells whose adjusted p-value is above the threshold are drawn as 0; the rows are the union of each column's top-N positive and top-N negative sets. See Enrichment (ORA and GSEA) for the runs themselves.
| Parameter | Default | What it does |
|---|---|---|
| Value | nes (signed_logp for overlap results) |
NES, signed −log10 padj, ES (enrichment score), or log2 fold enrichment. An overlap (ORA) result has no NES, so it defaults to the signed −log10 padj. |
| padj ≤ | 0.05 | Cells above this are drawn as 0. |
| Top N per column | 5 | Per column, positive and negative separately. |
| Direction | both | both, up or down. |
| Collapse rows (Jaccard ≥) | 0.5 | Merge rows whose member genes overlap at least this much; blank turns it off. The absorbed sets are listed in the row's tooltip. Needs the libraries cached locally. |
| Row order | peak | peak (by peak column), cluster, input, or custom. |
| Column order | input | input, cluster, or custom. |
| Colours | rdbu | Diverging color map: rdbu, prgn or roma. |
| Colour limit (±) | data max | Symmetric color limit. |
| Show values | off | Writes the value in each cell. |
| Label length | 40 | Characters before a label is cut. |
| Cell size (px) | 14 | Size of each heatmap cell. |
Order rows and columns by hand¶
On an enrichment heatmap you can drag a row label up or down, or a column label sideways; a teal line shows where it will land. Clicking a column label sorts the rows by that column's value (largest first; click again for smallest first). The new order redraws at once and is kept as params (row_order / col_order set to custom, with the names in row_custom_order / col_custom_order), so Save stores it, exports draw it, and Revert undoes it. Rows the custom list does not name (a higher Top N can bring some in) follow by peak column. clear under each order menu returns to the automatic order.
Enrichment network¶
Groups (squares) and gene sets (circles) linked by enrichment edges colored by sign, with optional dashed edges between gene sets that share members.
| Parameter | Default | What it does |
|---|---|---|
| Value, padj ≤, Top N per column, Direction | as the heatmap | Which edges are drawn. |
| Set–set edges (Jaccard ≥) | 0.3 | Dashed edges between sets whose members overlap at least this much; blank draws none. |
| Layout | force | force (force-directed) or bipartite (two columns). |
| Layout seed | 0 | Seed for the force layout. |
| Node size | degree | degree, n_set (set size) or constant. |
| Edge width | value | value or constant. |
| Label length | 30 | Characters before a label is cut. |
| Colours | rdbu | Diverging color map. |
Composition barplot, expression heatmap, dot plot¶
These carry the same options as their tabs, under the parameter names in the form: Bar order, Share of, Normalise to 100%, Min cells per bar and Show values for the barplot; Cell order, Gene order, Aggregate gene sets, the aggregate scoring options, Bins, One column per group and Scale each row 0..1 for the heatmap; and Dot colour, Scale, Expressing above, Gene order, Group order, Genes as rows, Colours, Background for the dot plot. The dot plot figure adds Colour limit and Largest dot at fraction (the fraction that fills the largest dot). When the rows come from a marker run, Top markers per group, Min % in group, Max % in others, Max adjusted p and Rank by select from the stored ranking without re-running the test. See Expression heatmaps and dot plots and Composition barplots.
CNV heatmap¶
Cells binned within each group (or one mean row per group) × genome windows, with chromosome separators and a diverging color scale. Parameters: Rows (cells or groups), Max rows (400), Group order (cnv_score, quietest group first, or category), Colour limit (±) (default the 99th percentile of the absolute value) and Colours. See Copy-number inference.
Panels¶
A saved Panels figure shows a summary and Open in Panels. It is edited and exported in the Panels tab, not here.
Edit, export and attach¶
- Select a figure in the list on the left. The list shows each figure's title, kind, id and how many recorded steps it was built from.
- Edit Title, Caption and the Parameters on the right. The plot previews each change live, without saving it.
- Click Save to keep the changes, or Revert to discard them. Each save is a recorded step.
- Export SVG or Export PNG (scale 1× to 4×) downloads the figure as drawn.
- Attach to record rasterizes the figure and attaches the PNG to the analysis record, linked to the step that created the figure. The record panel then shows an open link back to the figure. Save first: a figure with unsaved edits cannot be attached, because the record must be able to reproduce what it shows.
Duplicate copies a figure under a new id; Delete removes it (also a recorded step).
The Provenance section lists the step that created the figure and the steps its inputs came from; clicking a step opens the analysis record. It also summarizes the inputs and shows when the figure was created and last edited.
What it writes¶
| Where | What |
|---|---|
uns['skopia_figures'] |
One entry per figure, keyed by id: a JSON string holding kind, title, caption, inputs, the identities of the input runs, params, provenance and timestamps. |
uns['skopia_figures_seq'] |
The counter figure ids are numbered from. |
Rendered images are not stored in the AnnData. A PNG attached to the analysis record lives in the session's record and in a notebook or Markdown export; see Reproducibility.
Defaults¶
The default parameters of each kind live under figures: in the config file, one block per kind (figures.enrichment_heatmap, figures.expression_dotplot, …). A value you set there applies to new figures; existing records keep the params they were saved with. See Configure defaults.
Tips and pitfalls¶
Figures travel with the file
Figure records are part of .uns, so saving the dataset as .h5ad keeps them, and opening that file shows the same gallery. A figure whose inputs are also in the file draws again without re-running anything.
Index-based cells depend on the cell count
A figure drawn on a frozen mask (not a named subset) stores cell indices. Deleting or filtering cells afterwards renumbers the cells, so those indices then point at different cells. Only Panels figures check the cell count before drawing. Save a mask as a named subset before plotting when you expect to keep editing the dataset.