-
Notifications
You must be signed in to change notification settings - Fork 1
Plotting
Marinna Martini edited this page Apr 9, 2020
·
9 revisions
Here is my current favorite matplotlib plot setup, a code fragment reminder for now:
lines = []
fig, axes = plt.subplots(figsize=(15,2))
lines.append(axes.plot(t[0],ds[0]['wh_4061'][:,0,0],color='g',label=lbls[0]))
lines.append(axes.plot(t[1],ds[1]['wh_4061'][:,0,0],color='b',linestyle=':',label=lbls[1]))
lines.append(axes.plot(t[2],ds[2]['wh_4061'][:],color='r',label=lbls[2]))
#axes.set_ylim(10,14)
#axes.set_xlim(pydt[0],pydt[-1])
#axes.set_xlim(pydt[0],pydt[-1])
#axes.set_title('T_28')
axes.legend(loc='best')
the setup might also be
fig = plt.figure(figsize=(15,5))
ax = fig.add_subplot()
Another variant is
fig, ax = plt.subplots(figsize=(15,2))
ax.plot(ds['time'][burst_number,:],ds[var][burst_number,:])
ax.set(xlabel='sec')
ax.set(ylabel=ds[var].units)
ax.set(title=f'burst {burst_number} on {cft[burst_number]} in {infileroot[1:]}')