简体   繁体   中英

Using Plotly in Python Spyder IDE

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)

( Spyder developer here ) This is not possible at the moment (August 2017).

We're thinking how to improve this situation in the future, but we don't have a definite plan right now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM