y2et_low_18_cum, color='green', linewidth=2.5, label="Cumulative Low Trigger") axis[1].set_ylabel('Hectare-meters per hectare per day') axis[1].set_xlabel(header[0]) ax2.set_ylabel('Hectare-meters per hectare', color='black') # we already handled the x-label with ax1 # Set legend lns = lns1 + lns2 + lns3 + lns4 + lns5 labs = [l.get_label() for l in lns] axis[1].legend(lns, labs, loc=0, bbox_to_anchor=(.2, 0.95)) plt.ylabel('Hectare-meters per hectare') plt.xlabel(header[0]) start, end = axis[0].get_xlim() #axis[0].xaxis.set_ticks(np.arange(start, end, 90.0)) rf.title(axis[0], 'Irrigation water requirements for low and high trigger values', subplot_prefix='A') #rf.axis_numbering(axis[1], format_x=True) fmt = mdates.DateFormatter('%Y-%m-%d') rf.title(axis[1], 'Crop consumption for low and high trigger values', subplot_prefix='B') plt.tight_layout() plt.savefig('Fig10.png')
#add precip as separate y-axis lns3 = ax2.plot(plotdates, precip_cm, color='black', linewidth=1.5, label="Precipitation") axis[0].set_ylabel('Hectare-meters per hectare') axis[0].set_xlabel(header[0]) ax2.set_ylabel('Precipitation, in centemeters per day', color='black') # we already handled the x-label with ax1 start, end = axis[0].get_xlim() #axis[0].xaxis.set_ticks(np.arange(start, end, 90.0)) rf.title(axis[0], 'Irrigation water delivery for low and high crop coefficients', subplot_prefix='A') # Set legend lns = lns1 + lns2 + lns3 labs = [l.get_label() for l in lns] axis[0].legend(lns, labs, loc=0, bbox_to_anchor=(.3, 0.85)) handles, labels = axis[0].get_legend_handles_labels() #rf.legend(axis[0], handles, labels, bbox_to_anchor=(.9, 0.65)) # Create Figure 9 lns1 = axis[1].plot(plotdates, y2et_high_18, color='r',
axes[1].plot(plotdates, y2_high, color='r', linewidth=1.5, label=header[5]) axes[1].plot(plotdates, y3_high, color='b', linewidth=1.5, label=header[6]) axes[1].plot(plotdates, y2et_high, color='g', linewidth=1.5, label=header2[5]) axes[0].set_ylabel('Acre-feet per acre') axes[0].set_xlabel(header[0]) plt.ylabel('Acre-feet per acre') plt.xlabel(header[0]) start, end = ax.get_xlim() ax.xaxis.set_ticks(np.arange(start, end, 90.0)) rf.title( axes[0], 'Surface water and supplementary groundwater irrigation for low inflow hydrograph', subplot_prefix='A') rf.axes_numbering(axes[1], format_x=True) fmt = mdates.DateFormatter('%Y-%m-%d') rf.title( axes[1], 'Surface water and supplementary groundwater irrigation for high inflow hydrograph', subplot_prefix='B') # Set legend handles, labels = axes[0].get_legend_handles_labels() rf.legend(axes[0], handles, labels, bbox_to_anchor=(.9, 0.35)) # Set legend handles, labels = axes[1].get_legend_handles_labels()