我有一个函数,它采用 matplotlib 图并使用 tls.matplotlib_to_pyplot 将其转换为绘图。最后我将它命名为 plotly_fig。现在我正在尝试将滑块添加到一个破折号 web 应用程序。但是当我编译它时,我收到一条错误消息,说 plotly_fig 未定义。以下是一些重现错误的示例代码。import dashimport dash_core_components as dccimport dash_html_components as htmlimport numpy as npfrom numpy.linalg import matrix_powerimport matplotlib.pyplot as pltimport plotly.tools as tlsfrom mpl_toolkits.mplot3d import Axes3Dfrom dash.dependencies import Input, Outputapp = dash.Dash()#begin with the knobsapp.layout = html.Div([ dcc.Graph( id = 'graph', figure = plotly_fig), html.Label('Config L'), ## this is the knob for the length dcc.Slider( id = 'l', min = 5, max = 10, marks = {i: 'Label ={}'.format(i) if i == 1 else str(i) for i in range(5,10)}, value = L, ), html.Label('Config n'), ##knob for the n-gon dcc.Slider( id = 'n', min = 0, max = 10, marks = {i: 'Label ={}'.format(i) if i == 1 else str(i) for i in range(1,10)}, value = n, ), html.Label('Config N'), ##knob for the number of n-gons outside initial dcc.Slider( id = 'N', min = 0, max = 10, marks = {i: 'Label ={}'.format(i) if i == 1 else str(i) for i in range(1,10)}, value = N, ), html.Label('Config r'), ##knob for r only works on integers for now dcc.Slider( id = 'r', min = 0, max = 2, marks = {i: 'Label ={}'.format(i) if i == 1 else str(i) for i in range(1,2)}, value = r, ), html.Label('Config d'), ##knoc for the depth of the dip dcc.Slider( id = 'd', min = 0, max = 2, marks = {i: 'Label ={}'.format(i) if i == 1 else str(i) for i in range(1,2)}, value = d,)我究竟做错了什么?
添加回答
举报
0/150
提交
取消