Plotly 차트의 축 tick 회전 및 폰트 변경하기

Plotly x축 tick 회전 및 폰트 변경하기

Data Visualization
Plotly의 x축 tick을 변경하는 방법에 대해서 정리합니다.
Author

gabriel yang

Published

October 4, 2023

Plotly x축 tick 회전시키기

차트의 축에 표시될 tick 값의 길이가 긴 경우 tick을 회전 시키는 것이 좋습니다.

import plotly.graph_objects as go

fig = go.Figure(go.Scatter(
    mode = "lines+markers",
    y = [4, 1, 3, 1, 10, 3, 7, 11, 5, 7, 8, 2],
    x = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December",]))

fig.show()

x축과 y축의 tick의 fontsize와 회전을 적용합니다.

fig = go.Figure(go.Scatter(
    mode = "lines+markers",
    y = [4, 1, 3, 1, 10, 3, 7, 11, 5, 7, 8, 2],
    x = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December",]))

fig.update_xaxes(
        tickangle = 70,
        tickfont = {"size": 14},
        title_text = "Month",
        title_font = {"size": 20},
        title_standoff = 25)

fig.update_yaxes(
        title_text = "Temperature",
        title_standoff = 25)

tickfont로 x축의 tick의 글자크기를 설정합니다. title_font는 축 타이틀의 크기를 결정하고 title_standoff는 축과 title사이의 거리를 결정합니다.

Date Title Author
Jan 1, 3000 전체 카테고리 gabriel yang
Aug 18, 2024 Folium에서 Google Map 사용 방법 gabriel yang
Aug 16, 2024 Folium의 Choropleth 지도 gabriel yang
Aug 15, 2024 Folium 마커 생성과 색상 변경하기 gabriel yang
Oct 8, 2023 Plotly line, shape 그리기 gabriel yang
Oct 5, 2023 Plotly Funnel(깔대기) 차트 만들기 gabriel yang
Oct 3, 2023 Plotly 불릿차트 gabriel yang
Oct 2, 2023 Plotly Hover 설정하기 gabriel yang
Sep 30, 2023 Plotly Axis 포멧 변경하기 gabriel yang
Sep 28, 2023 Plotly 마커 모양 변경하기 gabriel yang
Sep 25, 2023 Plotly Time Series 날짜 범위 UI 사용하기 gabriel yang
Sep 22, 2023 Plotly Line Plot만들기 gabriel yang
Sep 21, 2023 Plotly Histogram Plot만들기 gabriel yang
Sep 18, 2023 Plotly Animation 만들기 gabriel yang
Sep 18, 2023 Plotly Box Plot만들기 gabriel yang
Sep 17, 2023 Plotly Treemap 만들기 gabriel yang
Sep 17, 2023 Plotly Bubble chart 만들기 gabriel yang
Sep 13, 2023 Plotly Subpolt 만들기 양성모
No matching items
Back to BLOG LIST