Save and export¶
Keep an interactive plot as HTML, save its definition as JSON, or download an image with the plot buttons.
Format |
Use it for |
How |
|---|---|---|
HTML |
Share an interactive plot |
|
JSON |
Save the chart definition and data references |
|
PNG |
A raster image for slides or reports |
PNG button |
SVG |
A vector image for editing figures |
SVG button |
Get a chart¶
Use show=False to keep the result of a plotting call. This example loads
Scanpy’s packaged PBMC data with existing UMAP coordinates.
import scanpy as sc
import genome_spy.integrations.scanpy as gsc
adata = sc.datasets.pbmc68k_reduced()
chart = gsc.pl.umap(adata, color="phase", zoom=True, show=False)
Save interactive HTML¶
This includes GenomeSpy’s display code and the chart’s supplied data in one file:
chart.save("umap.html", inline=True, controls=["png", "svg"])
HTML starts from the chart defined in Python. Open the file in a browser. Hover, zoom and browser-side linked plots remain interactive without Python. Sending selected cells back to Python needs a live notebook kernel.
inline=True includes the display code; it does not download external datasets.
Charts that load data from URLs still need access to those URLs.
Save the chart definition¶
chart.save("umap.json")
JSON stores the plot instructions and data references; it is not an image or a
standalone viewer. chart.save() writes HTML or JSON. Use the PNG/SVG buttons for
images. For PDF, export SVG and convert it in your figure editor.
Data use and provenance
The example uses 700 processed PBMC cells from 10x Genomics, supplied by Scanpy (CC BY 4.0). Existing coordinates and cell-cycle annotations are retained.
See Save, export, and share charts for more control options and serialization details.