Inline Interactive Plots with Plotly
Ensure latest version of Plotly is installed on your system with following command –
On Windows
py -m pip install --upgrade plotly
On Linux
python3 -m pip install --upgrade plotly
The method and code here is tested on plotly version 5.16.1.
To make inline interactive plot with plotly, add all the graph objects in a list and then pass this list to the iplot() function from plotly.offline as shown in the following example code –
Python3
import plotly.graph_objects as go from plotly.offline import iplot data = [go.Line(x = [ 1 , 2 , 3 ], y = [ 10 , 5 , 9 ]), go.Bar(x = [ 1 , 2 , 3 ], y = [ 10 , 5 , 9 ])] iplot(data) |
Output:
The interactive controls can be seen at the top right corner in Figure 3.
How to Use JupyterLab Inline Interactive Plots
This article shows how to create inline interactive plots in JupyterLab with Python-3 programming language. It assumes basic familiarity with JupyterLab/Jupyter Notebooks and Python-3. By the end of the article, the reader will be able to understand and create inline interactive plots with Matplotlib, Bokeh, and Plotly plotting libraries inside a Jupyter-Notebook (in JupyterLab) using Python-3.
Contact Us