반응형
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 | 31 |
Tags
- python error plot
- python significance level
- 분위수 변환
- matplotlib
- ecommerce data
- spearman
- Yeo-Johnsom 변환
- plot
- ttest
- Pearson
- 통계
- p value plot
- 빈도주의론
- cltv
- 데이터 시각화
- FWER
- 백분위 변환
- lifetimevalue
- E-Commerce
- marketing
- 베이지안론
- python
- 고객가치분석
- 데이터 분석
- error bar plot
- box-cox변환
- marketing insight
- 다중검정
- data analysis
- 시각화
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