Changeset 1573 in lmdz_wrf for trunk/tools/drawing_tools.py


Ignore:
Timestamp:
May 12, 2017, 9:25:55 PM (8 years ago)
Author:
lfita
Message:

Adding use of 'auto'
Changing example

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/drawing_tools.py

    r1559 r1573  
    98979897      ifclose= whether figure should be closed
    98989898    """
     9899    from scipy import stats as sts
    98999900    fname = 'plot_time_lag'
    99009901
    99019902    Nvalues = len(prevals)
    99029903
    9903     dxn = gen.fillValue
    9904     dxx = -gen.fillValue
    9905     dyn = gen.fillValue
    9906     dyx = -gen.fillValue
    9907 
    9908     for iv in range(Nvalues):
    9909         minv = np.min(prevals[iv])
    9910         maxv = np.max(prevals[iv])
    9911         if minv < dxn: dxn = minv
    9912         if maxv > dxx: dxx = maxv
    9913         minv = np.min(futvals[iv])
    9914         maxv = np.max(futvals[iv])
    9915         if minv < dyn: dyn = minv
    9916         if maxv > dyx: dyx = maxv
     9904    dxn = prerange[0]
     9905    dxx = prerange[1]
     9906    dyn = futrange[0]
     9907    dyx = futrange[1]
    99179908
    99189909    axstyles = ['pretty', 'Nfix', 'Stringlist', 'Vfix']
     
    1007310064
    1007410065            Nlag = int(figv[1])
    10075             col = gen.str_list_rep(figv[2],'@',Nvalues)
     10066            if figv[2] == 'auto':
     10067                col = colorsauto
     10068            else:
     10069                col = gen.str_list_rep(figv[2],'@',Nvalues)
    1007610070            mark = gen.str_list_rep(figv[3],'@',Nvalues)
    1007710071            size = gen.str_list_rep(figv[4],'@',Nvalues)
     
    1008310077                plt.plot(xvs[0:dimt-Nlag], yvs[Nlag:dimt], ',', color=col[iv],       \
    1008410078                  marker=mark[iv], markersize=size[iv])
     10079            # Computing correlation
     10080            corr, p_value = sts.pearsonr(xvs[0:dimt-Nlag], yvs[Nlag:dimt])
     10081            txt='corr= ' + '{0:.3g}'.format(corr) + ' p: ' + '{0:.2g}'.format(p_value)
     10082            plt.annotate(txt,xy=(0.95,0.05*(Nvalues-iv)), xycoords='figure fraction',\
     10083              color=col[iv], fontsize=lsiz, horizontalalignment='right')
    1008510084        else:
    1008610085            print errormsg
Note: See TracChangeset for help on using the changeset viewer.