I am working on plotting a simply line plot with some overlaying points but for whatever reason I can set the xlim just fine but setting the ylim does not work, neither does ybound. I have tried placing the line of code at the end of the block and in various places but that did nothing. Can anyone help me figure out why my plot seems to be ignoring this command? The code is below:
fig, ax = plt.subplots()
ax.plot(endpt,exceedperc,'-')
ax.set_title(ttl)
ax.set_xlabel(xlbl + spc + xunit)
ax.set_ylabel(ylbl + spc + yunit)
ax.yaxis.set_major_formatter(mtick.PercentFormatter(max(exceedperc)))
ax.yaxis.set_major_locator(mtick.MultipleLocator(0.1))
ax.grid()
ax.set_xlim(0,np.ceil(max(binlogi)))
ax.set_ylim(0,1)
# Text annotations at 1%, 5%, 10%, 25%, and 50% exceedances
ax.plot([x1[0],x5[0],x10[0],x25[0],x50[0]],[(1/100),(5/100),(10/100),(25/100),(50/100)],linestyle='None',marker='o',color='r')
ax.annotate(str(x1[0]) + spc + xunit, xy=(x1[0],(1/100)), xycoords='data', xytext=(4,4), textcoords='offset points')
ax.annotate(str(x5[0]) + spc + xunit,xy=(x5[0],(5/100)), xycoords='data', xytext=(4,4), textcoords='offset points')
ax.annotate(str(x10[0]) + spc + xunit,xy=(x10[0],(10/100)), xycoords='data', xytext=(4,4), textcoords='offset points')
ax.annotate(str(x25[0]) + spc + xunit,xy=(x25[0],(25/100)), xycoords='data', xytext=(4,4), textcoords='offset points')
ax.annotate(str(x50[0]) + spc + xunit,xy=(x50[0],(50/100)), xycoords='data', xytext=(4,4), textcoords='offset points')
I am expecting the y-axis to be limited from 0 to 1 with a 0.1 ticks but that is not the case. The results I get are a y limit from 0 to 1.04 and ticks at random intervals