Apr-11-2017, 08:58 AM
Dear Python Experts,
I got pretty far with my chart but I am stuck at showing every single day 1 to 365) on the x -axis rather than in steps of 50.
I dont know where this steps of 50 comes from, must be some default.
Here is my chart:
[Image: chart.jpg]
The code is the following:
I would be super happy for any hints.
I got pretty far with my chart but I am stuck at showing every single day 1 to 365) on the x -axis rather than in steps of 50.
I dont know where this steps of 50 comes from, must be some default.
Here is my chart:
[Image: chart.jpg]
The code is the following:
def linegraph(): #The following step prepares the data NOAA = data_summary() TMAX = NOAA[['Data_Value']].where(NOAA['Element'] =='TMAX')/10 TMAXx = TMAX.dropna() TMAXx_=TMAXx.reset_index(drop=True) DAYS = TMAXx_.index.tolist() TMIN = NOAA[['Data_Value']].where(NOAA['Element'] =='TMIN')/10 TMINx = TMIN.dropna() TMINx_= TMINx.reset_index(drop=True) #T... as Array TMAXSERIES= TMAXx_[TMAXx_.columns[0]].values TMINSERIES= TMINx_[TMINx_.columns[0]].values #-------------------------------------------- #The following part adds the caption x = np.arange(0,3,.25) y = np.sin(x) txt = ''' Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.''' fig = plt.figure() ax1 = fig.add_axes((.1,.4,.8,.5)) ax1.bar(x,y,.2) fig.text(.1,.1,txt) #--------------------------------------------------- time = [x**1 for x in range(366)] plt.xlim(1, 365) plt.title('My Title') plt.ylabel('C°') plt.xlabel('Day of the year') plt.legend(loc='upper right') #DOES NOT WORK, NO EFFECT #plot the TMAX and the TMIN data plt.plot(TMAXx_, '-', TMINx_, '-') return plt.fill_between(time,TMAXSERIES, TMINSERIES, where=TMAXSERIES>=TMINSERIES, facecolor='gray') linegraph()Besides the x axis I am also suprised that the legend does not show.
I would be super happy for any hints.