Plotly绘制金融时间序列图实战:配置滑动控件
# 可视化金融时间序列数据并设置时间粒度组件;
import plotly as py
import plotly.graph_objs as go
import pandas as pd
# ----------pre def
pyplt = py.offline.plot
# ----------code
df = pd.read_csv(r'day01.csv',index_col=[0])
trace = go.Scatter(x=df.index,
y=df.close)
data = [trace]
layout = dict(
title='时间序列的滑块与选择器',
xaxis=dict(
rangeselector=dict(
buttons=list([
dict(count=1,
label='1m',
step='month',
stepmode='backward'),
dict(count=6,
label='6m',
step='month',
stepmode='backward')