plotly histogram & distplot

최원빈·2023년 7월 7일

plotly templates

목록 보기
2/8
post-thumbnail

Youtube 이수안컴퓨터연구소
Plotly 한번에 끝내기 - 모던한 인터렉티브 시각화 라이브러리 동영상을 보고 요약한 코드입니다!

# px.histogram
fig = px.histogram(
    data, x=, y=,
    nbins=, # bin 개수
    histnorm = , # 바 그리는 기준, probability density/
    labels = { : }, # label 이름 변경
    opacity = , # 불투명도
    log_y = , log_x = , # log 스케일
    color = ,
    color_discrete_sequence = [ , ], # 색깔 구분 순서
    histfunc = , # 집계범위, count(by default)/avg
    marginal= , # rug/box/violin
    hover_data = , # [], data.columns
    hover_name = ,
    height =
)
fig.show()

# VS px.bar
fig1 = px.bar(
    data, x=, y=,
)
fig1.show()
fig2 = px.histogram(
    data, x=, y=,
    histfunc='sum'
)
fig2.show()

# go.Histogram
fig = go.Figure()
fig.add_trace(go.Histogram(
    data, x=, y=,
    cumulative_enables = , # 누적, True/False(by default)
))
fig.update_layout(
    barmode = '', # overlay/stack
)
fig.update_traces(
    opacity = , # 불투명도(투명도)
)
fig.show()

# ff.create_distplot
hist_data = [..]
group_labels = [..]

fig = ff.create_distplot(
    data,
    group_labels,
    bin_size = , # []/숫자
    show_hist = , # True/False
    show_curve = , # True/False
    show_rug = # True/False
)
fig.show()

# px.scatter로 나타내기
fig = px.scatter(
    data, x=, y=,
    marginal_x = , marginal_y = , # histogram/rug/box/violin
    color=,
)
profile
차가운 머리와 따뜻한 마음

0개의 댓글