Python으로 배우는 Plotly 데이터 시각화 입문
Alex Scriven
Data Scientist
사용자가 옵션 집합에서 선택할 수 있습니다
데이터 또는 레이아웃 요소를 업데이트합니다

$$
fig = go.Figure()for suburb in ['Ashfield', 'Lidcombe', 'Bondi Junction']: df = syd_houses[syd_houses.Suburb == suburb]fig.add_trace( px.bar(df, x='Year', y='Median House Price').data[0])
$$
visible 인자는 트레이스 표시 여부를 결정합니다 (True/False)args로 각 트레이스의 visible 값을 업데이트합니다args:[{'visible': [True, False, False]}]

# Create the dropdown dropdown_buttons = [ {'label': 'Ashfield', 'method': 'update','args': [{'visible': [True, False, False]}, {'title': 'Ashfield'}]},{'label': 'Lidcombe', 'method': 'update','args': [{'visible': [False, True, False]}, {'title': 'Lidcombe'}]},{'label': 'Bondi Junction', 'method': 'update','args': [{'visible': [False, False, True]}, {'title': 'Bondi Junction'}]}]
$$
fig.update_layout({
'updatemenus':[{
'type': "dropdown",
'x': 1.3,
'y': 0.5,
'showactive': True,
'active': 0,
'buttons': dropdown_buttons}]
})
fig.show()
$$

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