반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 통계
- FWER
- ecommerce data
- p value plot
- error bar plot
- Pearson
- marketing
- 백분위 변환
- spearman
- marketing insight
- 분위수 변환
- python error plot
- 다중검정
- 고객가치분석
- box-cox변환
- 데이터 시각화
- 빈도주의론
- cltv
- E-Commerce
- data analysis
- python significance level
- Yeo-Johnsom 변환
- matplotlib
- ttest
- python
- 데이터 분석
- plot
- lifetimevalue
- 베이지안론
- 시각화
Archives
- Today
- Total
Data 공부
[데이터 시각화] Python - text를 포함한 Radial Guage Chart 차트 본문
matplotlib을 통해 text를 포함한 원형 percent 차트그리는 방법입니다.
Input score 값에 따라 Radial Guage Chart가 표시됩니다.
예제 코드)
from math import pi
import numpy as np
from matplotlib.patches import Patch
from matplotlib.lines import Line2D
import matplotlib.pyplot as plt
import matplotlib as mpl
import matplotlib.font_manager as fm
from matplotlib.patches import FancyBboxPatch
def plot_score(score:int):
'''
plot score plot
Args:
score (int) : Score
'''
fig, ax = plt.subplots(figsize=(6, 6))
ax = plt.subplot(projection='polar')
data = [100, score]
startangle = 90
colors = ['#121CA7', '#0053CC']
xs = [(i * pi *2)/ 100 for i in data]
ys = [1, 1]
left = (startangle * pi *2)/ 360 #this is to control where the bar starts
# plot bars and points at the end to make them round
ax.bar(10 * 2 * np.pi/100, -4, width = 2 * np.pi, color='#AAD2E6', edgecolor = None, alpha=0.2)
ax.bar(10 * 2 * np.pi/100, 1, width = 2 * np.pi, color='#AAD2E6', edgecolor = None, alpha=0.2)
ax.barh(ys[1], xs[1], left=left, height=0.8, color=colors[1], alpha=1, zorder=2)
ax.barh(ys[0], xs[0], left=left, height=0.2, color=colors[0], alpha=0.2)
ax.scatter(xs[1]+left, ys[1]-0.005, s=250, color=colors[1], zorder=2)
ax.scatter(left+0.003, ys[1]+0.005, s=250, color=colors[1], zorder=2)
plt.ylim(-4, 4)
plt.text(-1.5, -3.5, score, ha='center', va='center', fontsize=90)
plt.xticks([])
plt.yticks([])
ax.spines.clear()
plt.show()
plot_score(90)
예제 PLOT)
반응형
'Data 공부 > 데이터 시각화' 카테고리의 다른 글
[데이터 시각화] Python - Error bar plot 그리기 (significance level추가) (0) | 2023.06.16 |
---|---|
[데이터 시각화] Python - 방사형 그래프 (Radar Chart) 그리기 (0) | 2023.06.12 |
[데이터 시각화] Python - gradientbar(matplotlib) (0) | 2023.06.12 |
[데이터 시각화] Python - Correlation Plot(sns.jointplot) (0) | 2023.06.12 |
Comments