python - Stretching Data Over Entire x-axis -


i plotted data using matplotlib , have large whitespace gap on end. ideas on how rid of it? (204 values plotted)

fig, ax = plt.subplots() ax.plot(osnow,'r-',label="observations") ax.plot(rsnow,'b-',label='merra') plt.xlabel('year') plt.ylabel('snow depth (cm)') plt.title('station '+str(stations[c])+' snow depth correlations') ax.set_xticks(np.arange(0,205,12)) ax.set_xticklabels(['1979','1980','1981','1982','1983','1984','1985','1986','1987','1988',                     '1989','1990','1991','1992','1993','1994','1995','1996'], fontsize = 'small') ax.text(30.0,35.0,'r = '+str(corr[0])+'', ha='center', va='center') plt.legend(loc='best') plt.show() 

enter image description here

as @plonser said above,

ax.set_xlim(0,205) 

Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -