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.

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
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.

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