質問編集履歴

1

ご教授頂いた修正をしたものです

2021/12/23 07:36

投稿

taihei_._
taihei_._

スコア15

test CHANGED
File without changes
test CHANGED
@@ -82,7 +82,57 @@
82
82
 
83
83
  ```
84
84
 
85
+ ###修正したコード
85
86
 
87
+ ```ここに言語を入力
88
+
89
+ import pandas as pd
90
+
91
+ import matplotlib.pyplot as plt
92
+
93
+ import numpy as np
94
+
95
+ from datetime import datetime
96
+
97
+
98
+
99
+ df_list1 = [pd.read_csv(f'C:/Users/mttai/cefas/dowsing/dowsing{i+2010}-wavenet-site.csv',header=None, skiprows=1,)[[0,1,2]] for i in range(10)]
100
+
101
+ df1=pd.concat([df_list1[i] for i in range(10)])
102
+
103
+ df1.columns=["Time (GMT)", "Dominant (peak) wave period (s)", "Significant wave height (Hm0) (m)"]
104
+
105
+ df1['Time (GMT)']=pd.to_datetime(df1['Time (GMT)'])
106
+
107
+ y = df1.groupby(df1['Time (GMT)'].dt.month)["Significant wave height (Hm0) (m)"].max()
108
+
109
+
110
+
111
+ fig, ax = plt.subplots(figsize=(10,4))
112
+
113
+ ax.plot(np.arange(1,13), y, color='red', label=r"dowsing", lw=2,marker='o',alpha=0.6)
114
+
115
+
116
+
117
+ ax.set_xlabel('月',fontname='MS Gothic',labelpad=15,fontsize=20)
118
+
119
+ ax.set_ylabel('有義波高 (m)',fontname='MS Gothic',labelpad=25,fontsize=20)
120
+
121
+ ax.set_ylim(0,3)
122
+
123
+ ax.set_xlim(1,12)
124
+
125
+ ax.tick_params(axis='x', labelsize= 15)
126
+
127
+ ax.tick_params(axis='y', labelsize=15)
128
+
129
+ ax.set_xticks([1,2,3,4,5,6,7,8,9, 10,11,12])
130
+
131
+ ax.set_yticks([0.5,1,1.5,2.0,2.5,3,0], minor=True)
132
+
133
+ plt.show()
134
+
135
+ ```
86
136
 
87
137
  ### 発生している問題・エラーメッセージ
88
138