Using Plotly in Python Spyder IDE

Viewed 3083

Is it possible to use plotly in the Spyder IDE to produce figures that show only in Spyder instead of the browser? I'm not bothered about the interactivity of the plot, I just want to see the figures in the IDE. If I run the following code it just opens in the browser. If I change the last line to pyo.iplot instead of plot, it just does nothing. I'm a bit lost!

import plotly.offline as pyo
from plotly.graph_objs import Figure, Data

pyo.offline.init_notebook_mode()

x = list(range(10))
y = [22,23,19,26,24,23,29,30,33,29]

trace = {'type':'scatter',
        'x' : x,
        'y' : y,
        'name':'simple trace',
        'mode':'lines'}

layout = {'title':'basic line',
         'xaxis':{'title':'x'},
         'yaxis':{'title':'y'}}

data = Data([trace])

fig = Figure(data=data, layout=layout)

pyo.plot(fig)
1 Answers
Related