Changeset 2443


Ignore:
Timestamp:
03/20/15 17:01:25 (9 years ago)
Author:
labetoulle
Message:

change default for y-range in plot_bilan : ymax = 2*(ideal daily consumption)

Location:
TOOLS/ConsoGENCMIP6/bin
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • TOOLS/ConsoGENCMIP6/bin/plot_bilan.py

    r2437 r2443  
    213213               linewidth=1, markersize=8, 
    214214               solid_capstyle="round", solid_joinstyle="round", 
    215                label="conso théorique (%)") 
     215               label="conso\nthéorique (%)") 
    216216  ax_theo.plot(xcoord, real_uses, line_style, color="forestgreen", 
    217217               linewidth=1, markersize=8, 
    218218               solid_capstyle="round", solid_joinstyle="round", 
    219                label="conso réelle (%)") 
     219               label="conso\nréelle (%)") 
    220220 
    221221 
     
    227227  # ------------------- 
    228228  # 1) Range 
     229  conso_max = np.nanmax(consos) 
    229230  if args.max: 
    230     ymax = gencmip6.alloc 
     231    ymax = np.nanmax(consos)  # + np.nanmax(consos)*.1 
    231232  else: 
    232     ymax = np.nanmax(consos) + np.nanmax(consos)*.1 
     233    ymax = 2. * conso_per_day 
     234 
     235  if conso_max > ymax: 
     236    ax_conso.annotate( 
     237      "{:.2e} heures".format(conso_max), 
     238      ha="left", 
     239      va="top", 
     240      fontsize="xx-small", 
     241      bbox=dict(boxstyle="round", fc="w", ec="0.5", color="gray",), 
     242      xy=(np.nanargmax(consos)+1.2, ymax), 
     243      textcoords="axes fraction", 
     244      xytext=(0.01, 0.9), 
     245      arrowprops=dict( 
     246        arrowstyle="->", 
     247        shrinkA=0, 
     248        shrinkB=0, 
     249        color="gray", 
     250      ), 
     251    ) 
    233252 
    234253  xmin, xmax = xcoord[0]-1, xcoord[-1]+1 
     
    260279  ax_conso.set_yticks(yticks) 
    261280 
     281  ax_theo.spines["right"].set_color("indianred") 
     282  ax_theo.tick_params(colors="indianred") 
     283  ax_theo.yaxis.label.set_color("indianred") 
     284 
    262285  ax_conso.axhline(y=conso_per_day, color="blue", alpha=0.5, 
    263                    label="conso journaliÚre idéale (heures)") 
     286                   label="conso journaliÚre\nidéale (heures)") 
    264287 
    265288  for x, d in zip(xcoord, dates): 
Note: See TracChangeset for help on using the changeset viewer.