Skip to content

GCWidget() ​

A chart as a Jupyter widget.

A cell that ends with the widget draws the chart. The widget's attributes hold what happened in the chart last (see the events of this module), zoom_to moves the zoom slider, and setting chart draws another chart in the same place.

Usage ​

python
from geneviewer.jupyter import GCWidget

GCWidget(chart, **kwargs)

Arguments ​

ArgumentTypeDescription
chartGCThe chart to draw.

Attributes ​

AttributeTypeDescription
chartGCThe chart drawn. Set it to draw another one in its place.
specdictThe spec of the chart, as the browser has it.
click, dblclick, select, selection, drag, moves, zoom, rendereddict, list or NoneThe last event of that name, None until it happens.

Examples ​

python
>>> from geneviewer import GC, datasets
>>> from geneviewer.jupyter import GCWidget
>>> genes = datasets.load("ophA_clusters")
>>> widget = GCWidget(GC(genes, cluster="cluster", group="class").zoom())
>>> widget.spec["fields"]
{'cluster': 'cluster', 'group': 'class'}
>>> widget.zoom_to([0, 0.5])