Use MatterViz in Jupyter and marimo
MatterViz’s viewers and plots also run as notebook widgets via pymatviz, built on anywidget. The same widgets work in Jupyter, JupyterLab, marimo and VS Code notebooks.
pip install pymatviz

Pass it Python objects
import pymatviz as pmv
pmv.structure(struct) # pymatgen Structure, ASE Atoms or PhonopyAtoms
pmv.trajectory(frames) # list of structures, or ASE / pymatgen trajectories
pmv.composition("Fe2O3")
pmv.scatter_plot(df, x="volume", y="energy", color="crystal_system")
Most widgets are also named after their component in snake_case (BrillouinZone → pmv.brillouin_zone, ConvexHull → pmv.convex_hull), and their keyword arguments are the component’s props. Every widget class lives in pmv.widgets, e.g. pmv.widgets.HistogramWidget, since pmv.histogram, pmv.rdf_plot and pmv.xrd_plot are pymatviz’s plotly functions. Just importing pymatviz makes pymatgen, ASE and phonopy objects render as widgets when they’re the last value in a cell, so struct on its own shows the 3D viewer.
Link widgets
Click a point in a scatter plot to show the matching structure:
scatter = pmv.scatter_plot(series=[{"x": steps, "y": energies}])
viewer = pmv.structure(frames[0])
pmv.widgets.link_selection(scatter, viewer, structures=frames)
Export without a notebook
The same widgets render headless, so scripts, CI and agents can produce figures:
widget.to_html("structure.html") # standalone, still interactive
widget.to_img("structure.png", dpi=150) # needs pip install pymatviz[export]
pmv.export_widgets({"a": w1, "b": w2}, "figures/", fmt="png")
Open files from the JupyterLab file browser
No code needed: with pip install matterviz-jupyterlab, double-click a .cif, POSCAR, XDATCAR, CHGCAR, .traj or other supported file to open it in a MatterViz viewer tab.

More
- Example notebooks: Jupyter, marimo, VS Code interactive
- pymatviz widget docs
- JupyterLab extension: formats and limits