python - plotly dash不刷新
问题描述
我是 plotly 和 dash 的新手 我有一些问题:我收到了这条消息:Serving Flask app "dash" (lazy loading)
- 环境:生产警告:不要在生产环境中使用开发服务器。请改用生产 WSGI 服务器。
- 调试模式:关闭
此外,除非我重新启动计算机或更改 app.run_server() 中的端口,否则我插入 Web 结果的网页会显示原始图形,这是我的代码:
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
import numpy as np
app = dash.Dash()
np.random.seed(42)
random_x = np.random.randint(1,101,100)
random_y = np.random.randint(1,101,100)
app.layout = html.Div([
dcc.Graph(
id='scatter3',
figure={
'data': [
go.Scatter(
x = random_x,
y = random_y,
mode = 'markers',
marker = {
'size': 12,
'color': 'rgb(51,204,153)',
'symbol': 'pentagon',
'line': {'width': 2}
}
)
],
'layout': go.Layout(
title = 'Random Data Scatterplot',
xaxis = {'title': 'Some random x-values'},
yaxis = {'title': 'Some random y-values'},
hovermode='closest'
)
}
)
])
if __name__ == '__main__':
app.run_server()
解决方案
将最后一行更改为app.run_server(debug=True)
.
推荐阅读
- python - sudo pip3 install pygame 和 sudo apt install python3-pygame 有什么区别
- mysql - Combining multiple LIKE and NOT LIKE in the same mysql query
- google-bigquery - Understanding Google Bigquery materialized views pricing
- javascript - javascript类中的静态异步函数
- mysql - MySQL Select Query 排除日期
- javascript - Tronweb 和 Trongrid 错误:请求失败,状态码 502
- javascript - 如何在 p5.play 中向鼠标旋转精灵?
- delphi - 检查在线文件是否存在的可靠方法
- python - Jupyter notebook:当我打开一个存在或创建一个新的 .ipynb 文件时,显示一个错误:“500:无效的继续字节”
- xslt - XSLT 1.0 中的变量为变量