回答編集履歴
2
Update
test
CHANGED
@@ -20,6 +20,7 @@
|
|
20
20
|
ax.xaxis.set_major_formatter(mdates.DateFormatter('%-m月'))
|
21
21
|
ax.grid(axis='y')
|
22
22
|
ax.legend(loc='upper left')
|
23
|
+
ax.tick_params(top=False)
|
23
24
|
ax.set_frame_on(False)
|
24
25
|
|
25
26
|
# 余りは非表示
|
@@ -28,5 +29,4 @@
|
|
28
29
|
fig.tight_layout(pad=2.0)
|
29
30
|
plt.show()
|
30
31
|
```
|
31
|
-

|
32
|
-
|
1
Update
test
CHANGED
@@ -7,10 +7,26 @@
|
|
7
7
|
plt.rcParams['font.family'] = 'MS Gothic'
|
8
8
|
|
9
9
|
df = pd.read_csv('熊本.csv', parse_dates=['年月'], index_col='年月')
|
10
|
+
fig, axes = plt.subplots(3, 2, figsize=(10, 10))
|
11
|
+
axes = axes.flatten()
|
10
|
-
|
12
|
+
years = range(1980, 2021, 10)
|
13
|
+
for year, ax in zip(years, axes):
|
14
|
+
df[df.index.year==year].plot(
|
15
|
+
y = '日の平均気温(℃)', x_compat=True, xlabel='',
|
11
|
-
|
16
|
+
label=f'{year}/1~{year}/12', title=f'{year}年 平均気温(℃)', ax=ax)
|
17
|
+
ax.set_ylim([0., 32.])
|
18
|
+
ax.xaxis.set_tick_params(reset=True)
|
12
|
-
|
19
|
+
ax.xaxis.set_major_locator(mdates.MonthLocator())
|
13
|
-
|
20
|
+
ax.xaxis.set_major_formatter(mdates.DateFormatter('%-m月'))
|
21
|
+
ax.grid(axis='y')
|
14
|
-
|
22
|
+
ax.legend(loc='upper left')
|
23
|
+
ax.set_frame_on(False)
|
24
|
+
|
25
|
+
# 余りは非表示
|
26
|
+
axes[-1].axis('off')
|
27
|
+
|
28
|
+
fig.tight_layout(pad=2.0)
|
15
|
-
|
29
|
+
plt.show()
|
16
30
|
```
|
31
|
+

|
32
|
+
|