Display controls and embed options¶
GenomeSpy Python adds SVG, PNG, and Inspector controls when it displays a chart. The controls appear when the chart is hovered or receives keyboard focus.
# Leaving the chart as the final expression uses SVG, PNG, and Inspector.
chart
Control |
What it does |
|---|---|
|
Downloads the current view as SVG. |
|
Downloads the current view as PNG. |
|
Opens the GenomeSpy Inspector, a developer view of the chart’s live structure, dataflow, and parameters. |
|
Expands the visualization; not enabled by default. |
Choose or hide controls¶
Pass controls=False to hide all controls. Pass a list to choose the controls
and their order:
# Display once without controls.
chart.display(controls=False)
# Display only PNG and SVG, in this order.
chart.display(controls=["png", "svg"])
Here is the same chart with only the PNG control:
The same option is available when retaining the notebook widget:
widget = chart.widget(controls=["inspector"])
Controls are display configuration and are not included in the chart
specification returned by to_dict() or to_json().
Embed options¶
embed_options are passed directly to GenomeSpy’s embed() function. This
example selects the Canvas renderer:
canvas_widget = chart.widget(embed_options={"renderer": "canvas"})
Controls and embed options can be configured together:
chart.widget(
controls=["png"],
embed_options={"renderer": "canvas"},
)
See GenomeSpy’s lists of embed options and controls.
HTML output¶
The controls option also applies to generated HTML:
html = chart.to_html(controls=["svg", "png"])
chart.save(directory / "variants.html", controls=False)
JSON output contains only the chart specification, so it does not include controls. See Save and inspect charts for JSON and HTML output.
Custom browser modules¶
By default, the widget and generated HTML load version-matched GenomeSpy
modules from jsDelivr. Self-hosted and offline setups can override
bundle_url, controls_module_url, and inspector_module_url. GenomeSpy’s
embedding guide lists the browser
entry points.