回答編集履歴

2

追記

2020/06/23 08:00

投稿

jeanbiego
jeanbiego

スコア3966

test CHANGED
@@ -97,3 +97,101 @@
97
97
  plt.show()
98
98
 
99
99
  ```
100
+
101
+ グラフまとめるver.
102
+
103
+ ```python3
104
+
105
+ import matplotlib as mpl
106
+
107
+ import matplotlib.pyplot as plt
108
+
109
+ import numpy as np
110
+
111
+ import pandas as pd
112
+
113
+ import datetime
114
+
115
+ import matplotlib.dates as mdates
116
+
117
+ import openpyxl
118
+
119
+
120
+
121
+ wb = openpyxl.load_workbook("Ren1.xlsx")
122
+
123
+ ws = wb["Sheet1"]
124
+
125
+
126
+
127
+ header_cells = ws[1]
128
+
129
+
130
+
131
+ student_list = []
132
+
133
+ for row in ws.iter_rows(min_row=3):
134
+
135
+ row_dic = {}
136
+
137
+ for k, v in zip(header_cells, row):
138
+
139
+ row_dic[k.value] = v.value
140
+
141
+ student_list.append(row_dic)
142
+
143
+
144
+
145
+ AV = []
146
+
147
+ for student in student_list:
148
+
149
+ AV.append(student["Average"])
150
+
151
+
152
+
153
+ start = []
154
+
155
+ for student in student_list:
156
+
157
+ start.append(student["Start time"])
158
+
159
+
160
+
161
+ stop = []
162
+
163
+ for student in student_list:
164
+
165
+ stop.append(student["Stop time"])
166
+
167
+
168
+
169
+ fig = plt.figure()
170
+
171
+ ax = fig.add_subplot(1,1,1)
172
+
173
+ for A, B, C in zip(start, stop, AV):
174
+
175
+ if C == "non":
176
+
177
+ continue
178
+
179
+ if A is None:
180
+
181
+ continue
182
+
183
+ x = np.arange(A, B, 0.1)
184
+
185
+ y = np.arange(-10, 10, 0.1)
186
+
187
+ y = x + C - x
188
+
189
+ ax.plot(x, y)
190
+
191
+ plt.ylim([-20, 20])
192
+
193
+ plt.xlim([-20, 20])
194
+
195
+ plt.show()
196
+
197
+ ```

1

追記

2020/06/23 07:59

投稿

jeanbiego
jeanbiego

スコア3966

test CHANGED
@@ -72,6 +72,10 @@
72
72
 
73
73
  for A, B, C in zip(start, stop, AV):
74
74
 
75
+ if C == "non":
76
+
77
+ continue
78
+
75
79
  x = np.arange(A, B, 0.1)
76
80
 
77
81
  y = np.arange(-10, 10, 0.1)