English 中文(简体)
Plotting Inline with Jupyter Notebook
  • 时间:2024-10-18

Plotly - Plotting Inpne with Jupyter Notebook


Previous Page Next Page  

In this chapter, we will study how to do inpne plotting with the Jupyter Notebook.

In order to display the plot inside the notebook, you need to initiate plotly’s notebook mode as follows −


from plotly.offpne import init_notebook_mode
init_notebook_mode(connected = True)

Keep rest of the script as it is and run the notebook cell by pressing Shift+Enter. Graph will be displayed offpne inside the notebook itself.


import plotly
plotly.tools.set_credentials_file(username =  lathkar , api_key =  ************ )
from plotly.offpne import iplot, init_notebook_mode
init_notebook_mode(connected = True)

import plotly
import plotly.graph_objs as go
import numpy as np
import math #needed for definition of pi

xpoints = np.arange(0, math.pi*2, 0.05)
ypoints = np.sin(xpoints)
trace0 = go.Scatter(
   x = xpoints, y = ypoints
)
data = [trace0]
plotly.offpne.iplot({ "data": data,"layout": go.Layout(title="Sine wave")})

Jupyter notebook output will be as shown below −

Jupyter Notebook

The plot output shows a tool bar at top right. It contains buttons for download as png, zoom in and out, box and lasso, select and hover.

Tool Bar Advertisements