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 logo - ipyleaflet examples Binder GitHub logo - ipyleaflet GitHub Repository

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.


from ipyleaflet import Map

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


With conda:
conda install -c conda-forge ipyleaflet
With pip:
pip install ipyleaflet
If you are using the classic Jupyter Notebook < 5.3 you need to run this extra command:
jupyter nbextension enable --py --sys-prefix ipyleaflet
If you are using JupyterLab ≤ 2, you will need to install the JupyterLab extension:
jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-leaflet
nglview Binder logo - nglview example Binder GitHub logo - nglview Github repository

A Jupyter widget to interactively view molecular structures and trajectories.


import pytraj as pt
import nglview as nv

traj = pt.load('', top='sim.prmtop')
view = nv.show_pytraj(traj)
view.add_cartoon('protein', color_scheme='residueindex')
view.add_ball_and_stick('not protein', opacity=0.5)