我有一個函數,它采用 matplotlib 圖并使用 tls.matplotlib_to_pyplot 將其轉換為繪圖。最后我將它命名為 plotly_fig?,F在我正在嘗試將滑塊添加到一個破折號 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
提交
取消