import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Indicator(
mode = "gauge",
gauge = {'axis': {'range':[None, 500]}},
value = 450,
title = {'text': "Speed"},
domain = {'row':0, 'column':0}
))
fig.add_trace(go.Indicator(
mode = "gauge+number",
gauge = {'axis': {'range':[None, 500]}},
value = 450,
title = {'text': "Speed"},
domain = {'row':0, 'column':1}))
fig.add_trace(go.Indicator(
mode = "gauge+delta",
gauge = {'axis': {'range':[None, 500]}},
value = 450,
delta = {'reference': 500},
title = {'text': "Speed"},
domain = {'row':1, 'column':0}
))
fig.add_trace(go.Indicator(
mode = "gauge+delta+number",
gauge = {'axis': {'range':[None, 500]}},
value = 450,
delta = {'reference': 500},
title = {'text': "Speed"},
domain = {'row':1, 'column':1}))
fig.update_layout(
grid = {'rows': 2, 'columns': 2, 'pattern': "independent"})Plotly 불릿차트
Plotly 불릿차트
Plotly 불릿차트
불릿(bullet)차트는 데이터 시각화에서 주로 성과를 추적하고 비교하는 데 주로 사용되는 차트입니다. Plotly로 불릿차트를 그리는 방법을 정리합니다.
블릿 차트는 대시보드나 리포트에서 성과 지표를 시각적으로 표시하는 데 자주 사용됩니다. 이러한 차트는 정보를 빠르게 파악할 수 있도록 도와줍니다.
Guage 기본사용법
Indictor는 number, delta, gauge의 세 가지 시각적 요소를 갖습니다. 이들의 조합을 mode로 전달합니다. 하나씩 설정하며 차이점을 확인합니다.
기본적인 조합을 알아보기 위해서 차트의 첫번째 컬럼을 확인합니다. 첫번째 줄은 gauge와 number를 사용한 결과를 나타냅니다. 첫번째 줄의 우측에 숫자가 추가된 것을 확인할 수 있습니다.
최대값을 500으로 정하기 위해서 gauge = {'axis': {'range': [None, 500]}}을 사용했습니다. 범위를 지정하지 않는 경우 현재 값에 맞춰 최댓값을 자동으로 설정합니다.
두번째 줄은 delta를 mode에 추가하고 delta의 값을 설정하기 위해서 {'reference': 500}을 사용했습니다. 500과의 차이를 화살표와 함께 표시하는 것을 알 수 있습니다.
불릿 차트 모양 변경하기
불릿차트는 angular와 bullet의 모양을 갖습니다. 동일한 설정에서 shape만 변경하여 표현하면 모양의 차이를 알 수 있습니다.
import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Indicator(
mode = "gauge+delta+number",
gauge = {'axis': {'range':[None, 500]},
'shape': 'angular'},
delta = {'reference': 500},
value = 450,
title = {'text': "Speed"},
domain = {'row':0, 'column':0}
))
fig.add_trace(go.Indicator(
mode = "gauge+delta+number",
gauge = {'axis': {'range':[None, 500]},
'shape': 'bullet'},
delta = {'reference': 500, 'position' : "top"},
value = 450,
title = {'text': "Speed"},
domain = {'row':1, 'column':0}
))
fig.update_layout(
grid = {'rows': 2, 'columns': 1, 'pattern': "independent"})위의 예제와 차이점은 delta에 position정보를 추가하여 두 번째 불릿차트에서는 delta정보가 위에 위치했습니다. position정보를 사용하면 delta의 표시 위치를 설정할 수 있습니다.
| Date | Title | Author |
|---|---|---|
| Aug 18, 2024 | Folium에서 Google Map 사용 방법 | |
| Aug 16, 2024 | Folium의 Choropleth 지도 | |
| Aug 15, 2024 | Folium 마커 생성과 색상 변경하기 | |
| Oct 8, 2023 | Plotly line, shape 그리기 | |
| Oct 5, 2023 | Plotly Funnel(깔대기) 차트 만들기 | |
| Oct 4, 2023 | Plotly 차트의 축 tick 회전 및 폰트 변경하기 | |
| Oct 2, 2023 | Plotly Hover 설정하기 | |
| Sep 30, 2023 | Plotly Axis 포멧 변경하기 | |
| Sep 28, 2023 | Plotly 마커 모양 변경하기 | |
| Sep 25, 2023 | Plotly Time Series 날짜 범위 UI 사용하기 | |
| Sep 22, 2023 | Plotly Line Plot만들기 | |
| Sep 21, 2023 | Plotly Histogram Plot만들기 | |
| Sep 18, 2023 | Plotly Animation 만들기 | |
| Sep 18, 2023 | Plotly Box Plot만들기 | |
| Sep 17, 2023 | Plotly Treemap 만들기 | |
| Sep 17, 2023 | Plotly Bubble chart 만들기 | |
| Sep 13, 2023 | Plotly Subpolt 만들기 |