Python으로 배우는 Plotly 데이터 시각화 입문
Alex Scriven
Data Scientist

몇 가지 핵심 요소가 있는 딕셔너리:
label = 버튼에 표시될 텍스트count = 버튼 클릭 시 이동할 step의 개수step = 이동할 기간('month', 'year', 'day')stepmode = 'backward' 또는 'todate''backward' = count만큼 바로 과거로 이동'todate' = 'backward'와 유사하나, 다음 완전한 기간의 시작으로 반올림
count=6, step='month')인 경우:stepmode='backward'는 시작점을 4월 20일로 확대(6개월 이전)stepmode='todate'는 시작점을 5월 1일로 확대(4월 20일의 다음 달 시작)
date_buttons = [ {'count': 6, 'step': "month", 'stepmode': "todate", 'label': "6MTD"},{'count': 14, 'step': "day", 'stepmode': "todate", 'label': "2WTD"} ]
fig = px.line(data_frame=rain, x='Date', y='Rainfall', title="Rainfall (mm) in Sydney")fig.update_layout(dict( xaxis=dict( rangeselector=dict(buttons=date_buttons) ))) fig.show()

2WTD 버튼 클릭:

6MTD 버튼 클릭:

Python으로 배우는 Plotly 데이터 시각화 입문