plotly pie chart

최원빈·2023년 7월 7일

plotly templates

목록 보기
6/8
post-thumbnail

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

import plotly.io as pio
import plotly.express as px
import plotly.graph_objects as go
import plotly.figure_factory as ff
from plotly.subplots import make_subplots
from plotly.validators.scatter.marker import SymbolValidator

# px.pie
fig = px.pie(
    data,
    values = ,
    names = ,
    hover_data = [], # hover data에 추가하고픈 정보
    labels = {'' : ''}, # 컬럼 이름 변경 가능
    color_discrete_sequence = , # 색깔 구성 순서, px.colors.sequential.Viridis
    hole = , # 구멍, .4
    textinfo = '', # 겉으로 보이는 text 정보, percent+label/value/..
    textfont_size = ,
    marker = dict(
        color = ,
        line = dict(
            color = ,
            width =
        ),
        pull = []
    )
)
fig.update_traces(
    textposition = '', # 텍스트 위치, inside/..
    textinfo = '', # 겉으로 보이는 text 정보, percent+label/..
    textfont_size = , # 텍스트 사이즈
)
fig.show()

# px.sunburst

data = dict(
    character = [],
    parent = [],
    value = []
)

fig = px.sunburst(
    data,
    names = 'character',
    parents = 'parent',
    values = # value
)
fig.show()

# -- polar chart --
# px.scatter_polar
fig = px.scatter_polar(
    data,
    r = , # 값 frequency
    theta = , # 방향 direction
    color = ,
    symbol = ,
    size = ,
    color_discrete_sequence = , # px.colors.sequential.Blues_r
)
fig.show()

# px.line_polar
fig = px.line_polar(
    data,
    r = ,
    theta = ,
    color = ,
    line_close = , # True
    template = '', # 템플릿 plotly_dark
    color_discrete_sequence = , # px.colors.sequential.deep
)
fig.show()

# px.bar_polar
fig = px.bar_polar(
    data,
    r = ,
    theta = ,
    color = ,
    template = ,
    color_discrete_sequence = , # px.colors.sequential.deep
)
fig.show()
profile
차가운 머리와 따뜻한 마음

0개의 댓글