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
- 머신러닝
- gini coefficient
- XGBoost
- scatter
- Python
- pyplot
- confusion matrix
- Heatmap
- Golang
- matplotlib
- bar
- 지니계수
- GINI
- sklearn
- decisiontree
- ml
Archives
- Today
- Total
Passion, Grace & Fire.
pyplot : bar 본문
bar plot의 경우 bottom에 기존에 그린 데이터를 넘겨 bar를 쌓을 수 있다.
import matplotlib.pyplot as plt
zero_list = [360852, 442223, 497644, 484917, 594990, 594205, 589594, 594648, 201882, 523143, 503879, 522342, 221514, 265356, 424278, 387469, 503955]
one_list = [234360, 152989, 97568, 110295, 222, 1007, 5618, 564, 393330, 72069, 91333, 72870, 373698, 329856, 170934, 207743, 91257]
features = ['ps_ind_06_bin', 'ps_ind_07_bin', 'ps_ind_08_bin', 'ps_ind_09_bin', 'ps_ind_10_bin', 'ps_ind_11_bin', 'ps_ind_12_bin', 'ps_ind_13_bin', 'ps_ind_16_bin', 'ps_ind_17_bin', 'ps_ind_18_bin', 'ps_calc_15_bin', 'ps_calc_16_bin', 'ps_calc_17_bin', 'ps_calc_18_bin', 'ps_calc_19_bin', 'ps_calc_20_bin']
plt.figure(figsize=(20, 12))
p1 = plt.bar(features, zero_list, color='b')
p2 = plt.bar(features, one_list, color='r', bottom=zero_list)
plt.title('Count of 1 and 0 in binary variables')
plt.legend((p1, p2), ("0", "1"), fontsize=15)
plt.show()
Comments