Changeset 981 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Aug 8, 2016, 6:22:33 PM (8 years ago)
Author:
lfita
Message:

Fixing wrong 'None' attribution of values in `ColorsLinesPointsStyles?'
Adding 'ColorsLinesPointsStyles?' in `plot_lines'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/drawing_tools.py

    r976 r981  
    56475647    return
    56485648
    5649 def plot_lines(vardv, varvv, vaxis, dtit, linesn, vtit, vunit, gtit, gloc, kfig):
     5649def plot_lines(vardv, varvv, vaxis, dtit, linesn, vtit, vunit, gtit, gloc, cs, ls,   \
     5650  ps, ws, ss, fv, fign, kfig):
    56505651    """ Function to plot a collection of lines
    56515652      vardv= list of set of dimension values
     
    56615662        5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
    56625663        9: 'upper center', 10: 'center'
     5664      cs= list of color names
     5665      ls= list of style of lines
     5666      ps= list of style of points
     5667      ws= list of withs of lines
     5668      ss= list of size of points
     5669      fv= frequency of values
     5670      fign= name of the figure
    56635671      kfig= kind of figure
    56645672      plot_lines([np.arange(10)], [np.sin(np.arange(10)*np.pi/2.5)], 'y', 'time (s)',      \
    5665   ['2.5'], 'sin', '-', 'sinus frequency dependency', 'pdf')
     5673  ['2.5'], 'sin', '-', 'sinus frequency dependency', 'sinus', 'pdf')
    56665674    """
    56675675    fname = 'plot_lines'
     
    56735681
    56745682# Canging line kinds every 7 lines (end of standard colors)
    5675     linekinds=['.-','x-','o-']
    5676     pointkindsauto=['.', ',', 'x', 'o', '*', '+', '<', '|', '_', '>', '1', '8', 's', \
    5677       'p', 'h', 'D']
    5678 
    56795683    Ntraj = len(vardv)
    56805684
    5681     N7lines = 0
     5685    cols, lins, pts, lws, pss = ColorsLinesPointsStyles(Ntraj, cs, ls, ps, ws, ss, fv)
    56825686
    56835687    xmin = 100000.
     
    57025706    if vaxis == 'x':
    57035707        for il in range(Ntraj):
    5704             plt.plot(varvv[il], vardv[il], linekinds[N7lines], label= linesn[il])
    5705             if il == 6: N7lines = N7lines + 1
     5708            plt.plot(varvv[il], vardv[il], lins[il], marker=pts[il],                 \
     5709              linewidth=lws[il], markersize=pss[il], label= linesn[il], color=cols[il])
    57065710
    57075711        plt.xlabel(vtit + ' (' + vunit + ')')
     
    57125716    else:
    57135717        for il in range(Ntraj):
    5714             plt.plot(vardv[il], varvv[il], linekinds[N7lines], label= linesn[il])
    5715             if il == 6: N7lines = N7lines + 1
     5718            plt.plot(vardv[il], varvv[il], lins[il], marker=pts[il],                 \
     5719              linewidth=lws[il], markersize=pss[il], label= linesn[il], color=cols[il])
    57165720
    57175721        plt.xlabel(dtit)
     
    57215725        plt.ylim(xmin,xmax)
    57225726
    5723     figname = 'lines'
    57245727    graphtit = gtit.replace('_','\_').replace('&','\&')
    57255728
     
    57275730    plt.legend(loc=gloc)
    57285731   
    5729     output_kind(kfig, figname, True)
     5732    output_kind(kfig, fign, True)
    57305733
    57315734    return
     
    57665769        Ncols = len(colorsauto)
    57675770        for ic in range(Nstyles):
    5768             iic = np.mod(ic,Ncols) - 1
    5769             if iic == 0: iic = Ncols - 1
     5771            imc = int(ic/Ncols)
     5772            iic = ic - imc * Ncols
    57705773            usecolors.append(colorsauto[iic])
    57715774    else:
     
    57865789        Nklns = len(linekindsauto)
    57875790        for il in range(Nstyles):
    5788             iil = np.mod(il,Nklns) - 1
    5789             if iil == 0: iil = Nklns - 1
     5791            iml = int(il/Nklns)
     5792            iil = il - iml * Nklns
    57905793            uselines.append(linekindsauto[iil])
    57915794    else:
     
    58065809        Nkpts = len(pointkindsauto)
    58075810        for ip in range(Nstyles):
    5808             iip = np.mod(ip,Nkpts) - 1
    5809             if iip == 0: iip = Nkpts - 1
     5811            imc = int(ip/Nkpts)
     5812            iip = ip - imc * Nkpts
    58105813            usepoints.append(pointkindsauto[iip])
    58115814    else:
     
    58265829        Nwlns = len(linewidthsauto)
    58275830        for il in range(Nstyles):
    5828             iil = np.mod(il,Nwlns) - 1
    5829             if iil == 0: iil = Nwlns - 1
     5831            iml = int(il/Nwlns)
     5832            iil = il - iml * Nwlns
    58305833            usewlines.append(linewidthsauto[iil])
    58315834    else:
     
    58465849        Nspts = len(pointsizesauto)
    58475850        for ip in range(Nstyles):
    5848             iip = np.mod(ip,Nspts) - 1
    5849             if iip == 0: iip = Nspts - 1
     5851            ipc = int(ip/Nspts)
     5852            iip = ip - ipc * Nspts
    58505853            usespoints.append(pointsizesauto[iip])
    58515854    else:
     
    58845887
    58855888#Nstyles = 3
    5886 #colors = ['blue']
     5889##colors = ['blue']
     5890#colors = None
    58875891#lines = ['-']
    58885892#points = ['x', '*', 'o']
     
    59996003    if vardv == 'h':
    60006004        print fname + '_____________________________________________________________'
    6001         print plot_lines.__doc__
     6005        print plot_lines_time.__doc__
    60026006        quit()
    60036007
Note: See TracChangeset for help on using the changeset viewer.