I have a function, tasmax_emn(year)
, which gives me an xarray data array containing December temperatures and dates for any year. How do I plot many different years (for example, 1990-2012) on the same plot?
For one year, I have success using this code:
fig1 = plt.figure(figsize=(15, 15), dpi=200)
ax1 = fig1.add_subplot(1, 1, 1)
ax1.plot(tasmax_emn(1990).time, tasmax_emn(1990), label="1990", linewidth=0.5, color ='k')
ax1.title.set_text('Tasmax ensemble mean')
ax1.set_xlabel('Date')
ax1.set_ylabel('Temperature (degrees C)')
ax1.legend()
plt.grid(True)
plt.show()
How do I plot all years from 1990 to 2012 without adding another 21 lines of code (I'm guessing some other function)?
Thanks for your help