1. Hover Label
- 데이터 시각화에서 마우스를 해당 데이터 포인트 위로 올렸을 때 나타나는 정보
fig.update_layout(
hoverlabel_bgcolor="white",
hoverlabel_font_size=10,
hoverlabel_font_color='black',
hoverlabel_font_family="Rockwell")
fig.show()
fig.update_traces(hovertemplate='총 매출: %{text}달러 <br>' ← <br>은 엔터라고 보면 됨!
'날짜: %{x} <br>'+
'판매량 : %{y}개')
fig.show()
2. Slider
- 슬라이더를 조작하여 특정 범위의 값을 선택하거나 조정
fig.update_layout(xaxis=dict(rangeslider_visible=True))
3. Drop Down
import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Line(
name="옵션 1 이름",
x=data["col"],
y=data["col"]
))
fig.add_trace(go.Line(
name="옵션 2 이름",
x=data["col"],
y=data["col"]
))
fig.update_layout(
updatemenus=[
dict(
type="dropdown",
direction="down",
buttons=list([
dict(label="Both",
method="update",
args=[{"visible": [True, True]},
{"title": "선택시 보여질 그래프 제목"}]),
dict(label="BottlesSold",
method="update",
args=[{"visible": [True, False]},← 첫번째 그래프 보여주기(True), 두번째 그래프 안보여주기(False)
{"title": "선택시 보여질 그래프 제목",}]),
dict(label="SaleDollars",
method="update",
args=[{"visible": [False, True]},← 첫번째 그래프 안보여주기(False), 두번째 그래프 보여주기(True)
{"title": "선택시 보여질 그래프 제목",}]),
]),
),
]
)
fig.show()