回答編集履歴
2
訂正
test
CHANGED
@@ -25,10 +25,6 @@
|
|
25
25
|
import pandas as pd
|
26
26
|
|
27
27
|
import matplotlib.pyplot as plt
|
28
|
-
|
29
|
-
from matplotlib.font_manager import FontProperties
|
30
|
-
|
31
|
-
yugothic_31bf3856ad364e35_6.3.9600.19358_none_c9cff602ed3e251f\yugothic.ttf', size=12)
|
32
28
|
|
33
29
|
|
34
30
|
|
1
追記
test
CHANGED
@@ -15,3 +15,65 @@
|
|
15
15
|
for (idx, row), ax in zip(df.iterrows(), axes.ravel()):
|
16
16
|
|
17
17
|
```
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
【追記】※matplotlibでの日本語の扱いについて詳しくは調べてください。下記コードはとりあえず日本語で表示しています。
|
22
|
+
|
23
|
+
```Python
|
24
|
+
|
25
|
+
import pandas as pd
|
26
|
+
|
27
|
+
import matplotlib.pyplot as plt
|
28
|
+
|
29
|
+
from matplotlib.font_manager import FontProperties
|
30
|
+
|
31
|
+
yugothic_31bf3856ad364e35_6.3.9600.19358_none_c9cff602ed3e251f\yugothic.ttf', size=12)
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
plt.rcParams['font.sans-serif'] = 'Yu Gothic'
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
df = pd.read_csv('renshu.csv', index_col='Name')
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
fig, axes = plt.subplots(nrows=2, ncols=3)
|
44
|
+
|
45
|
+
fig.suptitle("条件を満たす行とその分布", fontsize=12)
|
46
|
+
|
47
|
+
plt.subplots_adjust(hspace=0.5)
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
i = 1
|
52
|
+
|
53
|
+
for idx, row in df.iterrows():
|
54
|
+
|
55
|
+
score = row.sort_values(ascending=False)
|
56
|
+
|
57
|
+
if score.iloc[0] >= score.iloc[1] * 2:
|
58
|
+
|
59
|
+
subplot = plt.subplot(2,3,i)
|
60
|
+
|
61
|
+
subplot.bar(df.columns, row.values, align="center", width=0.8)
|
62
|
+
|
63
|
+
subplot.set_xticklabels(df.columns, rotation=85)
|
64
|
+
|
65
|
+
subplot.set_yticks([0,5,10,15,20])
|
66
|
+
|
67
|
+
subplot.set_title('Name: %s' % idx)
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
i += 1
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
plt.show()
|
76
|
+
|
77
|
+
```
|
78
|
+
|
79
|
+
![イメージ説明](ef10150f528e078a58417d102a786195.png)
|