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
| Argument | Type | Description |
|---|---|---|
chart | GC | The chart to draw. |
Attributes
| Attribute | Type | Description |
|---|---|---|
chart | GC | The chart drawn. Set it to draw another one in its place. |
spec | dict | The spec of the chart, as the browser has it. |
click, dblclick, select, selection, drag, moves, zoom, rendered | dict, list or None | The 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])