Discovering interactive visualization libraries in the Notebook
Several libraries provide interactive visualization of 2D or 3D data in the Notebook, using the capabilities of Jupyter widgets. We give basic examples using four of these libraries: ipyleaflet, bqplot, pythreejs, and ipyvolume.
Getting started
To install the libraries, type conda install -c conda-forge ipyleaflet bqplot pythreejs ipyvolume
in a Terminal.
How to do it...
First, we show a simple example of
ipyleaflet
, which offers a Python interface to use the Leaflet.js interactive mapping library (similar to Google Maps, but based on the open source project OpenStreetMaps):>>> from ipyleaflet import Map, Marker
We create a map around a given position specified in GPS coordinates:
>>> pos = [34.62, -77.34] m = Map(center=pos, zoom=10)
We also add a marker at that position:
>>> marker = Marker(location=pos, rise_on_hover=True, title="Here I am!", ...