Interactive Widgets

Jupyter widgets enable interactive data visualization in the Jupyter notebooks.

icon to represent multiple notebooks

Notebook Widgets

Notebooks come alive when interactive widgets are used. Users can visualize and control changes in the data. Learning becomes an immersive, plus fun, experience. Researchers can easily see how changing inputs to a model impacts the results.

ipyleaflet Binder GitHub

A library for creating simple interactive maps with panning and zooming, ipyleaflet supports annotations such as polygons, markers, and more generally any geojson-encoded geographical data structure.

Example

from ipyleaflet import Map

Map(center=[34.6252978589571, -77.34580993652344], zoom=10)

Installation

With conda:
conda install -c conda-forge ipyleaflet
With pip:
pip install ipyleaflet
jupyter nbextension enable --py --sys-prefix ipyleaflet
nglview

A Jupyter widget to interactively view molecular structures and trajectories.

Example

import pytraj as pt
import nglview as nv

traj = pt.load('sim.nc', top='sim.prmtop')
traj.strip(":TIP3")
view = nv.show_pytraj(traj)
view.clear()
view.add_cartoon('protein', color_scheme='residueindex')
view.add_ball_and_stick('not protein', opacity=0.5)
view