1
2
3
4
5
2
3
4
5
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from ipywidgets import interact, FloatSlider
from IPython.display import display
Interactive visualizations let learners explore data by manipulating parameters in real time.
In this notebook we load a dataset, create an ipywidgets slider, and use it to control the
amplitude of a 3D surface rendered with Plotly. The same workflow works with
matplotlib, Panel, and other Python visualization libraries.
Use the Upload File button in the toolbar to add a CSV. The file is written
to the in-browser filesystem and is immediately available to pandas.
| x | y | z | |
|---|---|---|---|
| 0 | -6.000000 | -6.000000 | 0.921994 |
| 1 | -5.586207 | -6.000000 | 0.796034 |
| 2 | -5.172414 | -6.000000 | 0.531627 |
| 3 | -4.758621 | -6.000000 | 0.168203 |
| 4 | -4.344828 | -6.000000 | -0.237841 |
| 5 | -3.931035 | -6.000000 | -0.613529 |
| 6 | -3.517241 | -6.000000 | -0.878465 |
| 7 | -3.103448 | -6.000000 | -0.975218 |
The @interact decorator creates a widget control that re-runs the
function whenever the slider moves. Drag the Amplitude slider to reshape the surface in real time.