Using Plotly in Python Spyder IDE

有些话、适合烂在心里 提交于 2020-07-03 07:56:54

问题


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:


(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.



来源:https://stackoverflow.com/questions/45714150/using-plotly-in-python-spyder-ide

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!