Plotly for Spyder

I am unable to view interactive plots in Ipython console using spyder IDE. Whenever I am using iplot function, it gives me an output β€œ<plotly.tools.PlotlyDisplay object>”. Please help me resolve this issue.

1 Like

@nitish_a iplot generates a plot only in an Jupyter Notebook.

1 Like

Hi @nitish_a,

As @empet explained, iplot doesn’t work in Spyder. You’re best bet is to use plotly.plotly.plot (online) or plotly.offline.plot (offline), which will display the plot in your default web browser. For example

from plotly.offline import plot
import plotly.graph_objs as go

fig = go.Figure(data=[{'type': 'scatter', 'y': [2, 1, 4]}])

plot(fig)

1 Like

You can also change default renderer.

import plotly.io as pio
pio.renderers.default = "browser"
1 Like