如何使用子图生成图表工作室链接
我正在尝试在Python中构建DASH应用程序,该应用程序在Localhost:8050, 例如,这里有三个数字,它们与dcc.graph一起返回。
def funct(data, x_data, y_data ):
line_fig = px.line(x=x_data, y=y_data, title="Trend Line")
indi_fig = go.Indicator(value = len(data), title='Total Count')
bar_fig = go.Bar(x=x_data, y=y_data)
return dcc.Grapgh(figure=line_fig), dcc.Grapgh(figure=indi_fig),
dcc.Grapgh(figure=bar_fig)
但是,我想使用Chart Studio分享它, 在提供了用户名和API键之后,我希望该功能能够像下面一样起作用
import chart_studio.plotly as py
def funct(data, x_data, y_data ):
line_fig = px.line(x=x_data, y=y_data, title="Trend Line")
indi_fig = go.Indicator(value = len(data), title='Total Count')
bar_fig = go.Bar(x=x_data, y=y_data)
final_grid = [line_fig, indi_fig, bar_fig]
return py.plot(final_grid, auto_open=True) #creates charts in plotly public repo
。如果我只通过一个无花果,我就可以成功运行它,例如,
return py.plot(line_fig, auto_open=True)
我敢肯定我缺少一些重要的东西,但不确定是什么。 3个不同图表的原因只是自定义以及它们在浏览器中显示的方式。我没有在此处的代码中提到它。
I am trying to build a Dash application in python that prints out three charts on localhost:8050,
For example, here are three figures which are returned with dcc.Graph
def funct(data, x_data, y_data ):
line_fig = px.line(x=x_data, y=y_data, title="Trend Line")
indi_fig = go.Indicator(value = len(data), title='Total Count')
bar_fig = go.Bar(x=x_data, y=y_data)
return dcc.Grapgh(figure=line_fig), dcc.Grapgh(figure=indi_fig),
dcc.Grapgh(figure=bar_fig)
This works perfectly, however, I want to share it using chart studio,
after providing username and api key, I want the function to work like below
import chart_studio.plotly as py
def funct(data, x_data, y_data ):
line_fig = px.line(x=x_data, y=y_data, title="Trend Line")
indi_fig = go.Indicator(value = len(data), title='Total Count')
bar_fig = go.Bar(x=x_data, y=y_data)
final_grid = [line_fig, indi_fig, bar_fig]
return py.plot(final_grid, auto_open=True) #creates charts in plotly public repo
This doesn't work though. I am able to successfully run it if I pass only one fig, for eg.,
return py.plot(line_fig, auto_open=True)
I'm sure I'm missing something important, but not sure what. The reason for 3 different charts is just customization and the way they are displayed in browser. I have not mentioned it in the code here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论