亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Figure 沒有被保存在函數之外的 plotly-dash 中。我該如何解決?

Figure 沒有被保存在函數之外的 plotly-dash 中。我該如何解決?

收到一只叮咚 2021-10-26 18:33:21
我有一個函數,它采用 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,)我究竟做錯了什么?
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 252 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號