How to Range Slider and Selector with Plotly-Dash(如何使用 Plotly-Dash 设置滑块和选择器的范围)
本文介绍了如何使用 Plotly-Dash 设置滑块和选择器的范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 Dash 重新创建此 Plotly 示例,但我无法获得按钮和范围滑块.有谁知道我该怎么做?
I am trying to recreate this Plotly example with Dash, but I cannot get the buttons and the range slider. Does anyone know how I can do this?
这就是我尝试过的:
traces =[{
'x':df.index,
'y':df.level,
'type': 'scatter',
'mode': 'lines',
'name': 'a_level'
}]
graphs.append(dcc.Graph(
id='a_level',
figure={
'data': traces,
'layout': {
'type': 'date',
'rangeslider': {'visible':True},
'margin': {'b': 0, 'r': 10, 'l': 60, 't': 0}
}
}
)
推荐答案
rangeslider 是 xaxis 的一个属性.
我使用这样的东西:
app = dash.Dash(__name__, external_stylesheets=['https://codepen.io/chriddyp/pen/bWLwgP.css'])
app.layout = html.Div([
dcc.Graph(
id='bar_plot',
figure=go.Figure(
data=area,
layout=go.Layout(
xaxis={
'rangeslider': {'visible':True},
'rangeselector': {'visible':True, 'buttons':[{'step':'all'}, {'step':'day'}, {'step':'hour'}]}
},
)))
])
这篇关于如何使用 Plotly-Dash 设置滑块和选择器的范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
编程基础网
本文标题为:如何使用 Plotly-Dash 设置滑块和选择器的范围
基础教程推荐
猜你喜欢
- Discord.py 缺少必需的参数 2022-01-01
- 与常规 dict 相比,Python manager.dict() 非常慢 2022-01-01
- pyserial - 可以从线程 a 写入串行端口,是否阻塞从线程 b 读取? 2022-01-01
- 由Python将MP3转换为MIDI(类型错误:无法加载插件:mtg-Melodia:Melodia) 2022-01-01
- 尝试制作WhatsApp机器人 2022-01-01
- 使用生成器和迭代器时 Python 多循环失败 2022-01-01
- 用 Python 编写 Fortran 无格式文件 2022-01-01
- numpy float:比算术运算中内置的慢 10 倍? 2022-01-01
- 在 Celery 工作人员中捕获 Heroku SIGTERM 以优雅地关 2022-01-01
- 将 x 轴刻度更改为自定义字符串 2022-01-01
