atomli.visualize
Generated from the public Python surface of Atomli 0.1.18.
Interactive 3D structure viewing in Jupyter. Mirrors ase.visualize.
from atomli.build import bulkfrom atomli.visualize import view
view(bulk("Cu", "fcc", a=3.6)) # one structureview(read("run.extxyz", ":")) # a trajectory, with a scrubberA bare Atoms in a cell renders the same viewer, so atoms on the last line
of a cell is enough.
Watching a run as it happens:
v = view(atoms)dyn = BFGS(atoms)dyn.attach(v.update, interval=1)dyn.run(fmax=0.05)update streams each geometry into the mounted viewer in place, so the camera
and the reader’s scrub position survive every step.
The renderer is Tako’s public widget, loaded from tako.atom.li and cached by the browser. Structures are serialized by the native extended-XYZ writer, which carries the cell, the periodic flags and per-atom arrays.
Documentation pages mount viewers and plots natively from JSON. View controls
(set_frame, select, set_view, …) are recorded and written with the spec,
and a Study bundles figures, linked structure states, tables and provenance:
from atomli.visualize import Study, plot
study = Study("water-stretch", "Stretching water", system="H2O", method="GFN2-xTB")study.fact("energy_a", -5.07, "eV", precision=2)study.figure("energies", plot.plotly({"data": [{"type": "bar", "x": ["A", "B"], "y": [0.0, 0.4], "customdata": ["A", "B"]}]}))study.figure("structure", Viewer([water]))study.link("pick", source="energies", target="structure", states={"A": water, "B": stretched})study.provenance("energy", "GFN2-xTB single points")study.write("out/water-stretch") # study.json, figures/, states/Study(id, title, *, system=None, method=None, description=None)
Section titled “Study(id, title, *, system=None, method=None, description=None)”Builder for one documentation study. Every builder method returns self.
fact(self, key, value, unit=None, *, label=None, precision=None)
Section titled “fact(self, key, value, unit=None, *, label=None, precision=None)”Add a headline number (finite int/float) or short string.
figure(self, id, obj, *, height=None, caption=None)
Section titled “figure(self, id, obj, *, height=None, caption=None)”Register a Plot or Viewer (or FieldViewer) under a unique id.
link(self, id, *, source, target, states, by='id', initial=None, fps=None, labels=None)
Section titled “link(self, id, *, source, target, states, by='id', initial=None, fps=None, labels=None)”Let a plot click or a table row select a structure state in a viewer.
source: Id of a registered plot whose point customdata equals a state id, or None.
target: Id of a registered viewer figure.
states: Maps state id to a Viewer, an Atoms, or a sequence of Atoms.
labels: Optional state id to display label.
provenance(self, quantity, source)
Section titled “provenance(self, quantity, source)”One line saying where a computed or reference number comes from.
table(self, id, columns, rows, *, select=None, id_column='id')
Section titled “table(self, id, columns, rows, *, select=None, id_column='id')”A table of rows; with select, choosing a row drives that link.
write(self, directory)
Section titled “write(self, directory)”Write study.json, figures/ and states/ under directory; return study.json’s Path.
view(atoms, data=None, viewer=None, repeat=None, block=False, height=None, *, widget=False, **look)
Section titled “view(atoms, data=None, viewer=None, repeat=None, block=False, height=None, *, widget=False, **look)”Show a structure or trajectory. Mirrors ase.visualize.view.
The first five parameters are ASE’s, in ASE’s order, so an unmodified ASE
script calling view(atoms, None, 'ase', (2, 2, 2)) positionally binds the
same way here.
atoms: An Atoms, or a sequence of them shown as a trajectory.
data: Accepted for ASE signature compatibility and ignored. ASE
passes it to an external GUI; there is no external GUI here.
viewer: None, "ase" (ASE’s own default spelling) or "tako" all
select the built-in viewer. Any other name raises, rather than
silently showing something the caller did not ask for.
repeat: Supercell repetition, e.g. (2, 2, 2), applied before display.
block: Accepted for ASE signature compatibility and ignored. Nothing
blocks: the viewer is a cell output, not a window to wait on.
height: Viewer height; a bare number is read as pixels.
look: Appearance options passed to the renderer: style,
colorScheme, material, background, atomScale, bondScale,
bondColorMode, edges, bonds, labels, axes, legend, cell,
polyhedra, autoRotate, controls, title, width.
Returns: A Viewer, which renders itself in a notebook cell.
view_pdb(source, *, representation='cartoon', remove_waters=True, chains=None, height=None, widget=False, **look)
Section titled “view_pdb(source, *, representation='cartoon', remove_waters=True, chains=None, height=None, widget=False, **look)”Show a PDB structure as a protein ribbon.
v = view_pdb("3PTB.pdb", chains=["A"])v.select(v.find(resname="BEN"))source: A PDB file path or PDB text.
representation: "cartoon", "tube", "trace" or "atoms".
remove_waters: Drop crystallographic waters (default), which clutter a ribbon figure.
chains: Keep only these chain ids; default keeps all.
look: The options of view; cell is off unless given, because a
crystal cell box would also set the camera fit.
Returns: A ProteinViewer. Its atom indices follow the filtered PDB in file order.
Viewer(images, height=None, look=None, script_url='https://tako.atom.li/embed/tako-viewer.js')
Section titled “Viewer(images, height=None, look=None, script_url='https://tako.atom.li/embed/tako-viewer.js')”A mounted viewer. Returned by view; displays itself in a cell.
Hold on to it only if you intend to stream into it (update); otherwise
view(atoms) on its own line is all you need.
add_angle(self, i, j, k, *, label=None, offset=None)
Section titled “add_angle(self, i, j, k, *, label=None, offset=None)”Add an angle measurement in degrees, with j as the vertex.
add_distance(self, i, j, *, label=None, offset=None)
Section titled “add_distance(self, i, j, *, label=None, offset=None)”Add a distance measurement in angstrom between two atom indices.
as_widget(self)
Section titled “as_widget(self)”Return an anywidget view with Python callbacks and direct image capture.
Install atomli[visualization] to use this interface.
The ordinary HTML display does not require anywidget.
auto_rotate(self, enabled=True)
Section titled “auto_rotate(self, enabled=True)”Enable or disable continuous camera rotation.
capture_png(self, filename=None, *, dpi=400, timeout=30)
Section titled “capture_png(self, filename=None, *, dpi=400, timeout=30)”Capture a connected widget as PNG bytes, with optional local file output.
Display as_widget() before awaiting this method.
A timeout reports a missing or disconnected browser view.
clear_annotations(self)
Section titled “clear_annotations(self)”Remove tags, bond-order labels, measurements, and custom annotations.
close(self)
Section titled “close(self)”Release the mounted viewer and its graphics resources.
load(self, atoms)
Section titled “load(self, atoms)”Replace the structure, keeping the look. Accepts one Atoms or a sequence.
The atom count may change. Recorded frame and selection commands refer to the old structure and are dropped.
off(self, event, callback)
Section titled “off(self, event, callback)”Remove a registered Python event callback.
on(self, event, callback)
Section titled “on(self, event, callback)”Register a Python callback for a live widget event.
Display as_widget() to connect the notebook kernel.
Structure events include select, camera, frame, ready, and error.
Plot events include click, hover, relayout, ready, and error.
pause(self)
Section titled “pause(self)”Pause trajectory playback.
play(self)
Section titled “play(self)”Start trajectory playback.
reset_camera(self)
Section titled “reset_camera(self)”Fit the camera to the structure.
save(self, filename, dpi=400, fps=12, every=1)
Section titled “save(self, filename, dpi=400, fps=12, every=1)”Save the view to a file. .png for a frame, .gif for the run.
v = view(traj)v.save("relaxation.gif", fps=20)v.save("final.png", dpi=600) # 400 by defaultThe picture is produced by the renderer, which lives in the browser, so the file is delivered through the browser’s download flow and lands in its download directory rather than beside the notebook. Nothing is written when there is no live viewer (a headless run, or a reloaded notebook whose kernel is gone).
filename: Output name; the extension picks the format.
dpi: Capture resolution, default 400 (print quality); 96 is
screen size. Pixel count grows with the SQUARE of this, so a long
trajectory at 400 can exceed the GIF encoder’s budget; lower dpi
or raise every when it says so.
fps: GIF playback rate.
every: Keep every Nth frame of the GIF; the last is always kept.
select(self, indices)
Section titled “select(self, indices)”Highlight zero-based atom indices. Pass an empty sequence to clear.
set(self, **options)
Section titled “set(self, **options)”Change appearance or scene overlays without replacing the viewer.
Both snake_case Python names and existing JavaScript names are accepted. Atom indices are zero-based and follow the supplied structure order.
set_bond_orders(self, values, **style)
Section titled “set_bond_orders(self, values, **style)”Label bond midpoints from i, j, order records or a symmetric matrix.
set_camera(self, *, position, target, up=(0, 1, 0), zoom=1, projection='perspective')
Section titled “set_camera(self, *, position, target, up=(0, 1, 0), zoom=1, projection='perspective')”Set world-space camera vectors and zoom without changing the structure.
set_fps(self, fps)
Section titled “set_fps(self, fps)”Set the trajectory playback rate in frames per second.
set_frame(self, index)
Section titled “set_frame(self, index)”Pause playback and show a zero-based trajectory frame.
set_tags(self, values, **style)
Section titled “set_tags(self, values, **style)”Label atoms from a sequence, an index mapping, ‘index’, or Atoms tags.
set_view(self, face)
Section titled “set_view(self, face)”Point the camera along top, bottom, front, back, left, or right.
to_html(self, *, full_document=False)
Section titled “to_html(self, *, full_document=False)”Return the interactive viewer as HTML with a shared renderer script.
to_spec(self)
Section titled “to_spec(self)”A plain dict for native mounting: options, recorded commands, summary.
update(self, atoms=None)
Section titled “update(self, atoms=None)”Push the current geometry into the live viewer as a new frame.
Designed for dyn.attach(viewer.update, interval=n): it takes no
required argument and reads viewer.atoms by default.
Frames are appended, never re-rendered, so the camera and the reader’s scrub position survive. Silently does nothing outside IPython, so the same script runs unchanged from a terminal.
write_html(self, filename)
Section titled “write_html(self, filename)”Write an interactive HTML page to the local filesystem.
write_spec(self, path, *, structure_path=None, structure_url=None)
Section titled “write_spec(self, path, *, structure_path=None, structure_url=None)”Write to_spec() as JSON and return its Path.
With structure_path the extxyz goes to that file and the spec carries
options["src"] (structure_url, else the file’s basename) instead of
inline data.
ProteinViewer(source, height=None, look=None, *, remove_waters=True, chains=None, script_url='https://tako.atom.li/embed/tako-viewer.js')
Section titled “ProteinViewer(source, height=None, look=None, *, remove_waters=True, chains=None, script_url='https://tako.atom.li/embed/tako-viewer.js')”A viewer for a PDB structure rendered as a protein ribbon.
Atom indices (select, find, near, tags) refer to the atoms of the
filtered PDB text in file order: the first kept ATOM or HETATM line is
index 0. Waters, other chains, extra models and alternate locations are
removed before indexing. Ligands and ions keep the selected atom style.
add_angle(self, i, j, k, *, label=None, offset=None)
Section titled “add_angle(self, i, j, k, *, label=None, offset=None)”Add an angle measurement in degrees, with j as the vertex.
add_distance(self, i, j, *, label=None, offset=None)
Section titled “add_distance(self, i, j, *, label=None, offset=None)”Add a distance measurement in angstrom between two atom indices.
as_widget(self)
Section titled “as_widget(self)”Return an anywidget view with Python callbacks and direct image capture.
Install atomli[visualization] to use this interface.
The ordinary HTML display does not require anywidget.
auto_rotate(self, enabled=True)
Section titled “auto_rotate(self, enabled=True)”Enable or disable continuous camera rotation.
capture_png(self, filename=None, *, dpi=400, timeout=30)
Section titled “capture_png(self, filename=None, *, dpi=400, timeout=30)”Capture a connected widget as PNG bytes, with optional local file output.
Display as_widget() before awaiting this method.
A timeout reports a missing or disconnected browser view.
clear_annotations(self)
Section titled “clear_annotations(self)”Remove tags, bond-order labels, measurements, and custom annotations.
close(self)
Section titled “close(self)”Release the mounted viewer and its graphics resources.
find(self, *, chain=None, resname=None, resid=None, name=None, hetero=None, element=None)
Section titled “find(self, *, chain=None, resname=None, resid=None, name=None, hetero=None, element=None)”Atom indices matching every given field, in file order.
load(self, source)
Section titled “load(self, source)”Replace the structure with another PDB, keeping the look and the filters.
near(self, indices, radius, *, residues=True)
Section titled “near(self, indices, radius, *, residues=True)”Indices of atoms within radius angstrom of indices, excluding those atoms.
With residues=True (default) a residue is included whole when any of
its atoms qualifies, which is how a binding pocket is usually drawn.
off(self, event, callback)
Section titled “off(self, event, callback)”Remove a registered Python event callback.
on(self, event, callback)
Section titled “on(self, event, callback)”Register a Python callback for a live widget event.
Display as_widget() to connect the notebook kernel.
Structure events include select, camera, frame, ready, and error.
Plot events include click, hover, relayout, ready, and error.
pause(self)
Section titled “pause(self)”Pause trajectory playback.
play(self)
Section titled “play(self)”Start trajectory playback.
reset_camera(self)
Section titled “reset_camera(self)”Fit the camera to the structure.
save(self, filename, dpi=400, fps=12, every=1)
Section titled “save(self, filename, dpi=400, fps=12, every=1)”Save the view to a file. .png for a frame, .gif for the run.
v = view(traj)v.save("relaxation.gif", fps=20)v.save("final.png", dpi=600) # 400 by defaultThe picture is produced by the renderer, which lives in the browser, so the file is delivered through the browser’s download flow and lands in its download directory rather than beside the notebook. Nothing is written when there is no live viewer (a headless run, or a reloaded notebook whose kernel is gone).
filename: Output name; the extension picks the format.
dpi: Capture resolution, default 400 (print quality); 96 is
screen size. Pixel count grows with the SQUARE of this, so a long
trajectory at 400 can exceed the GIF encoder’s budget; lower dpi
or raise every when it says so.
fps: GIF playback rate.
every: Keep every Nth frame of the GIF; the last is always kept.
select(self, indices)
Section titled “select(self, indices)”Highlight zero-based atom indices. Pass an empty sequence to clear.
set(self, **options)
Section titled “set(self, **options)”Change appearance or scene overlays without replacing the viewer.
Both snake_case Python names and existing JavaScript names are accepted. Atom indices are zero-based and follow the supplied structure order.
set_bond_orders(self, values, **style)
Section titled “set_bond_orders(self, values, **style)”Label bond midpoints from i, j, order records or a symmetric matrix.
set_camera(self, *, position, target, up=(0, 1, 0), zoom=1, projection='perspective')
Section titled “set_camera(self, *, position, target, up=(0, 1, 0), zoom=1, projection='perspective')”Set world-space camera vectors and zoom without changing the structure.
set_fps(self, fps)
Section titled “set_fps(self, fps)”Set the trajectory playback rate in frames per second.
set_frame(self, index)
Section titled “set_frame(self, index)”Pause playback and show a zero-based trajectory frame.
set_tags(self, values, **style)
Section titled “set_tags(self, values, **style)”Label atoms from a sequence, an index mapping, ‘index’, or Atoms tags.
set_view(self, face)
Section titled “set_view(self, face)”Point the camera along top, bottom, front, back, left, or right.
to_html(self, *, full_document=False)
Section titled “to_html(self, *, full_document=False)”Return the interactive viewer as HTML with a shared renderer script.
to_spec(self)
Section titled “to_spec(self)”A plain dict for native mounting: options, recorded commands, summary.
update(self, atoms=None)
Section titled “update(self, atoms=None)”Push the current geometry into the live viewer as a new frame.
Designed for dyn.attach(viewer.update, interval=n): it takes no
required argument and reads viewer.atoms by default.
Frames are appended, never re-rendered, so the camera and the reader’s scrub position survive. Silently does nothing outside IPython, so the same script runs unchanged from a terminal.
write_html(self, filename)
Section titled “write_html(self, filename)”Write an interactive HTML page to the local filesystem.
write_spec(self, path, *, structure_path=None, structure_url=None)
Section titled “write_spec(self, path, *, structure_path=None, structure_url=None)”Write to_spec() as JSON and return its Path.
With structure_path the extxyz goes to that file and the spec carries
options["src"] (structure_url, else the file’s basename) instead of
inline data.
view_field(atoms, field, **options)
Section titled “view_field(atoms, field, **options)”Display a density, orbital, spin, or potential field with Tako isosurfaces.
isovalue= uses the field’s value_unit. color_by= accepts another
native field on the same grid, for example ESP mapped onto electron density.
Returns a FieldViewer that supports notebook display and HTML export.
FieldViewer(atoms, field, *, isovalue, color_by=None, colormap='auto', surface='auto', opacity=0.65, positive_color='#2563eb', negative_color='#ea580c', title=None, height=460, look=None, script_url=None)
Section titled “FieldViewer(atoms, field, *, isovalue, color_by=None, colormap='auto', surface='auto', opacity=0.65, positive_color='#2563eb', negative_color='#ea580c', title=None, height=460, look=None, script_url=None)”Interactive Tako isosurface from a native scalar-field mapping.
Field values keep their declared units. Only the display payload is reduced to Float32; the source arrays and scientific calculations remain unchanged. A field belongs to one geometry, so trajectory streaming is unavailable.
add_angle(self, i, j, k, *, label=None, offset=None)
Section titled “add_angle(self, i, j, k, *, label=None, offset=None)”Add an angle measurement in degrees, with j as the vertex.
add_distance(self, i, j, *, label=None, offset=None)
Section titled “add_distance(self, i, j, *, label=None, offset=None)”Add a distance measurement in angstrom between two atom indices.
as_widget(self)
Section titled “as_widget(self)”Return an anywidget view with Python callbacks and direct image capture.
Install atomli[visualization] to use this interface.
The ordinary HTML display does not require anywidget.
auto_rotate(self, enabled=True)
Section titled “auto_rotate(self, enabled=True)”Enable or disable continuous camera rotation.
capture_png(self, filename=None, *, dpi=400, timeout=30)
Section titled “capture_png(self, filename=None, *, dpi=400, timeout=30)”Capture a connected widget as PNG bytes, with optional local file output.
Display as_widget() before awaiting this method.
A timeout reports a missing or disconnected browser view.
clear_annotations(self)
Section titled “clear_annotations(self)”Remove tags, bond-order labels, measurements, and custom annotations.
close(self)
Section titled “close(self)”Release the mounted viewer and its graphics resources.
load(self, atoms)
Section titled “load(self, atoms)”Replace the structure, keeping the look. Accepts one Atoms or a sequence.
The atom count may change. Recorded frame and selection commands refer to the old structure and are dropped.
off(self, event, callback)
Section titled “off(self, event, callback)”Remove a registered Python event callback.
on(self, event, callback)
Section titled “on(self, event, callback)”Register a Python callback for a live widget event.
Display as_widget() to connect the notebook kernel.
Structure events include select, camera, frame, ready, and error.
Plot events include click, hover, relayout, ready, and error.
pause(self)
Section titled “pause(self)”Pause trajectory playback.
play(self)
Section titled “play(self)”Start trajectory playback.
reset_camera(self)
Section titled “reset_camera(self)”Fit the camera to the structure.
save(self, filename, dpi=400, fps=12, every=1)
Section titled “save(self, filename, dpi=400, fps=12, every=1)”Save the view to a file. .png for a frame, .gif for the run.
v = view(traj)v.save("relaxation.gif", fps=20)v.save("final.png", dpi=600) # 400 by defaultThe picture is produced by the renderer, which lives in the browser, so the file is delivered through the browser’s download flow and lands in its download directory rather than beside the notebook. Nothing is written when there is no live viewer (a headless run, or a reloaded notebook whose kernel is gone).
filename: Output name; the extension picks the format.
dpi: Capture resolution, default 400 (print quality); 96 is
screen size. Pixel count grows with the SQUARE of this, so a long
trajectory at 400 can exceed the GIF encoder’s budget; lower dpi
or raise every when it says so.
fps: GIF playback rate.
every: Keep every Nth frame of the GIF; the last is always kept.
select(self, indices)
Section titled “select(self, indices)”Highlight zero-based atom indices. Pass an empty sequence to clear.
set(self, **options)
Section titled “set(self, **options)”Change appearance or scene overlays without replacing the viewer.
Both snake_case Python names and existing JavaScript names are accepted. Atom indices are zero-based and follow the supplied structure order.
set_bond_orders(self, values, **style)
Section titled “set_bond_orders(self, values, **style)”Label bond midpoints from i, j, order records or a symmetric matrix.
set_camera(self, *, position, target, up=(0, 1, 0), zoom=1, projection='perspective')
Section titled “set_camera(self, *, position, target, up=(0, 1, 0), zoom=1, projection='perspective')”Set world-space camera vectors and zoom without changing the structure.
set_fps(self, fps)
Section titled “set_fps(self, fps)”Set the trajectory playback rate in frames per second.
set_frame(self, index)
Section titled “set_frame(self, index)”Pause playback and show a zero-based trajectory frame.
set_isovalue(self, value)
Section titled “set_isovalue(self, value)”Change the contour in the field’s declared units; no electronic solve.
set_opacity(self, value)
Section titled “set_opacity(self, value)”Set the surface opacity between zero (exclusive) and one.
set_slice(self, *, axis='z', position=0.5, keep='below', style='both', enabled=True)
Section titled “set_slice(self, *, axis='z', position=0.5, keep='below', style='both', enabled=True)”Clip an isosurface or show a section at a fractional grid position.
set_tags(self, values, **style)
Section titled “set_tags(self, values, **style)”Label atoms from a sequence, an index mapping, ‘index’, or Atoms tags.
set_view(self, face)
Section titled “set_view(self, face)”Point the camera along top, bottom, front, back, left, or right.
to_html(self, *, full_document=False)
Section titled “to_html(self, *, full_document=False)”Return the interactive viewer as HTML with a shared renderer script.
to_snapshot(self)
Section titled “to_snapshot(self)”Return the portable Tako snapshot, including units and volume samples.
to_spec(self, *, isovalue_range=None, controls=True)
Section titled “to_spec(self, *, isovalue_range=None, controls=True)”Native-mount spec: look options, inline snapshot, and slider controls.
isovalue_range: (lo, hi) slider range in the field’s value_unit;
defaults to a quarter to four times the current isovalue.
controls: False omits the controls block.
update(self, atoms=None)
Section titled “update(self, atoms=None)”Push the current geometry into the live viewer as a new frame.
Designed for dyn.attach(viewer.update, interval=n): it takes no
required argument and reads viewer.atoms by default.
Frames are appended, never re-rendered, so the camera and the reader’s scrub position survive. Silently does nothing outside IPython, so the same script runs unchanged from a terminal.
write_html(self, filename)
Section titled “write_html(self, filename)”Write an interactive HTML page to the local filesystem.
write_spec(self, path, *, snapshot_path=None, snapshot_url=None, isovalue_range=None, controls=True)
Section titled “write_spec(self, path, *, snapshot_path=None, snapshot_url=None, isovalue_range=None, controls=True)”Write to_spec() as JSON. With snapshot_path the snapshot goes to its own file.
Plot(kind: 'str', content: 'Mapping[str, Any]', *, title=None, height=360, width='100%', broadening=None, sticks=True, layout=None, config=None, script_url='https://tako.atom.li/embed/tako-plot.js', widget=False)
Section titled “Plot(kind: 'str', content: 'Mapping[str, Any]', *, title=None, height=360, width='100%', broadening=None, sticks=True, layout=None, config=None, script_url='https://tako.atom.li/embed/tako-plot.js', widget=False)”An interactive plot with hover values, legends, and image export.
Display the object in a trusted notebook, or call write_html.
update replaces data in the existing figure.
set changes the title, layout, broadening, or stick display.
as_widget(self)
Section titled “as_widget(self)”Return an anywidget view with Python callbacks and direct image capture.
Install atomli[visualization] to use this interface.
The ordinary HTML display does not require anywidget.
capture_png(self, filename=None, *, dpi=400, timeout=30)
Section titled “capture_png(self, filename=None, *, dpi=400, timeout=30)”Capture a connected widget as PNG bytes, with optional local file output.
Display as_widget() before awaiting this method.
A timeout reports a missing or disconnected browser view.
close(self)
Section titled “close(self)”Release the browser figure and its event handlers.
off(self, event, callback)
Section titled “off(self, event, callback)”Remove a registered Python event callback.
on(self, event, callback)
Section titled “on(self, event, callback)”Register a Python callback for a live widget event.
Display as_widget() to connect the notebook kernel.
Structure events include select, camera, frame, ready, and error.
Plot events include click, hover, relayout, ready, and error.
relayout(self, **layout)
Section titled “relayout(self, **layout)”Change Plotly layout fields in the live figure.
restyle(self, update, traces=None)
Section titled “restyle(self, update, traces=None)”Change trace styles by zero-based trace index in the live figure.
save(self, filename, *, scale=2)
Section titled “save(self, filename, *, scale=2)”Write HTML locally, or download PNG, SVG, JPEG, or WebP through the browser.
set(self, **options)
Section titled “set(self, **options)”Set title, broadening, sticks, dimensions, layout, or config.
to_dict(self)
Section titled “to_dict(self)”Return an independent JSON-compatible copy of the plot specification.
to_html(self, *, full_document=False)
Section titled “to_html(self, *, full_document=False)”Return an interactive HTML figure that loads the shared plot renderer.
to_json(self, *, indent=2)
Section titled “to_json(self, *, indent=2)”Return the widget specification as JSON.
to_spec(self)
Section titled “to_spec(self)”Return a plain dict for native mounting: spec, recorded commands, summary.
update(self, content)
Section titled “update(self, content)”Replace the plot data and keep the mounted widget.
write_html(self, filename)
Section titled “write_html(self, filename)”Write a standalone interactive HTML page to the local filesystem.
write_spec(self, path)
Section titled “write_spec(self, path)”Write to_spec() as JSON and return its Path.