235 def plotCurve(df, var, label, withBand=True, withCurve=True):
236 """
237 Plot curve with possible error band where large intervals are distinguished by color
238 """
239
240 def plotBands(df, var, color, withBand=True, withCurve=True):
241 varUnc = var + 'Unc'
242 nan = np.full(len(df), np.nan)
243 avg = (df['t1']+df['t2']).to_numpy()/2
244 times = np.c_[df[['t1', 't2']].to_numpy(), avg].ravel()
245 eCMS = np.c_[df[[var, var]].to_numpy(), nan].ravel()
246 times = toJST(times)
247
248 if withBand:
249 eCMSu = np.c_[df[[varUnc, varUnc]].to_numpy(), nan].ravel()
250 plt.fill_between(times, eCMS-eCMSu, eCMS+eCMSu, alpha=0.15, color=color)
251 if withCurve:
252 plt.plot(times, eCMS, linewidth=2, color=color)
253
254 nan = np.full(len(df), np.nan)
255 avg = (df['t1']+df['t2']).to_numpy()/2
256 timesg = np.c_[df['t1'].to_numpy(), avg, df['t2'].to_numpy()].ravel()
257 eCMSg = np.c_[df[var].to_numpy(), nan, df[var].to_numpy()].ravel()
258 timesg = toJST(timesg)
259
260 if withCurve:
261 plt.plot(timesg, eCMSg, linewidth=2, color='gray', alpha=0.35)
262
263 plotBands(df[df['type'] == 1], var, 'red', withBand, withCurve)
264 plotBands(df[df['type'] == -1], var, 'blue', withBand, withCurve)
265