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

chart.save("umap.html", inline=True)

JSON

Save the chart definition and data references

chart.save("umap.json")

PNG

A raster image for slides or reports

PNG button

SVG

A vector image for editing figures

SVG button

Download notebook

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)

Use the plot buttons

Hover over the plot, or give it keyboard focus, to reveal PNG and SVG. Zoom or pan first to export the current view. PNG works well for dense plots; SVG keeps the marks as editable vectors.

In a notebook, choose the buttons when displaying the chart:

chart.display(controls=["png", "svg"])

For a DotPlot, MatrixPlot or EmbeddingSummary builder, call .to_chart() first. Use controls=False to hide the buttons. The same choice works with chart.widget(...) and when saving HTML.

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.