Changeset 1157 in lmdz_wrf


Ignore:
Timestamp:
Oct 7, 2016, 10:43:24 AM (9 years ago)
Author:
lfita
Message:

Adding use of:

latex_tex', legend_values', dimxyf', colorbarvalues' and `close'

Location:
trunk/tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/drawing.py

    r1151 r1157  
    670670    draw_2D_shad_cont(ncfile, values, varn)
    671671      ncfile= [ncfilevars],[ncfilevarc] files to use (one value, same file)
    672       values=[vnamefs];[dimvals];[dimvalc];[dimxvn];[dimyvn];[colorbar];[ckind];[clabfmt];[sminv],[smaxv];[sminc],[smaxv],[Nlev];[figt];[kindfig];[reverse];[timevals]
     672      values=[vnamefs];[dimvals];[dimvalc];[dimxvn];[dimyvn];[dimxyfmt];[colorbarvals];[ckind];[clabfmt];[sminv],[smaxv];[sminc],[smaxv],[Nlev];[figt];[kindfig];[reverse];[timevals];[close]
    673673        [vnamefs],[vnamefc]: Name in the figure of the shaded and the contour variables
    674674        [dimvals/c]: list of [dimname]|[value] telling at which dimension of the
     
    676676        [dimxvn]: name of the variables with the values of the dimension of the x-axis
    677677        [dimyvn]: name of the variables with the values of the dimension of the y-axis
    678         [colorbar]: name of the color bar
     678        [dimxyfmt]=[dxf],[Ndx],[dyf],[Ndy]: format of the values at each axis
     679          [dxs]: style of x-axis ('auto' for 'pretty')
     680            'Nfix', values computed at even 'Ndx'
     681            'Vfix', values computed at even 'Ndx' increments
     682            'pretty', values computed following aprox. 'Ndx' at 'pretty' intervals (2.,2.5,4,5,10)
     683          [dxf]: format of the labels at the x-axis
     684          [Ndx]: Number of ticks at the x-axis
     685          [ordx]: angle of orientation of ticks at the x-axis ('auto' for horizontal)
     686          [dys]: style of y-axis ('auto' for 'pretty')
     687          [dyf]: format of the labels at the y-axis
     688          [Ndy]: Number of ticks at the y-axis
     689          [ordy]: angle of orientation of ticks at the y-axis ('auto' for horizontal)
     690        [colorbarvals]=[colbarn],[fmtcolorbar],[orientation]
     691          [colorbarn]: name of the color bar
     692          [fmtcolorbar]: format of the numbers in the color bar 'C'-like ('auto' for %6g)
     693          [orientation]: orientation of the colorbar ('vertical' (default, by 'auto'), 'horizontal')
    679694        [ckind]: kind of contours
    680695          'cmap': as it gets from colorbar
     
    682697          'fixsigc,[colname]': fixed color [colname], >0 stright, <0 dashed  line
    683698        [clabfmt]: format of the labels in the contour (None, also possible)
    684         [smin/axv]: minimum and maximum value for the shading
     699        [smin/axv]: minimum and maximum value for the shading or:
     700          'Srange': for full range
     701          'Saroundmean@val': for mean-xtrm,mean+xtrm where xtrm = np.min(mean-min@val,max@val-mean)
     702          'Saroundminmax@val': for min*val,max*val
     703          'Saroundpercentile@val': for median-xtrm,median+xtrm where xtrm = np.min(median-percentile_(val),
     704            percentile_(100-val)-median)
     705          'Smean@val': for -xtrm,xtrm where xtrm = np.min(mean-min*@val,max*@val-mean)
     706          'Smedian@val': for -xtrm,xtrm where xtrm = np.min(median-min@val,max@val-median)
     707          'Spercentile@val': for -xtrm,xtrm where xtrm = np.min(median-percentile_(val),
     708             percentile_(100-val)-median)
    685709        [sminc]:[smaxv]:[Nlev]: minimum, maximum and number of values for the contour
    686710        [figt]: title of the figure ('|' for spaces)
     
    690714          'flip',[x/y]: flip only the dimension [x] or [y]
    691715        [timevals]: [timen]|[units]|[kind]|[tfmt]|[label] time labels characteristics
    692            [timen]; name of the time variable
    693            [units]; units string according to CF conventions ([tunits] since
    694              [YYYY]-[MM]-[DD] [[HH]:[MI]:[SS]], '!' for spaces)
    695            [kind]; kind of output
    696              'Nval': according to a given number of values as 'Nval',[Nval]
    697              'exct': according to an exact time unit as 'exct',[tunit];
    698                tunit= [Nunits],[tu]; [tu]= 'c': centuries, 'y': year, 'm': month,
    699                 'w': week, 'd': day, 'h': hour, 'i': minute, 's': second,
    700                 'l': milisecond
    701            [tfmt]; desired format
    702            [label]; label at the graph ('!' for spaces)
     716          [timen]; name of the time variable
     717          [units]; units string according to CF conventions ([tunits] since
     718            [YYYY]-[MM]-[DD] [[HH]:[MI]:[SS]], '!' for spaces)
     719          [kind]; kind of output
     720            'Nval': according to a given number of values as 'Nval',[Nval]
     721            'exct': according to an exact time unit as 'exct',[tunit];
     722              tunit= [Nunits],[tu]; [tu]= 'c': centuries, 'y': year, 'm': month,
     723               'w': week, 'd': day, 'h': hour, 'i': minute, 's': second,
     724               'l': milisecond
     725          [tfmt]; desired format
     726          [label]; label at the graph ('!' for spaces)
     727        [close]: Whether figure should be finished or not
    703728      valules= 'rh,ta;z|-1,x|-1;z|-1,x|-1;lat;pressure;BuPu;fixsigc,black;%d;0.,100.;195.,305.,7;Meridonal|average|of|rh|&|ta;pdf;flip@y;time!hours!since!1949/12/01|exct,5d|%d|date!([DD])'
    704729      varn= [varsn],[varcn] name of the variable to plot with shading variable with contour
     
    711736        quit()
    712737
    713     expectargs = '[vnamefs];[dimvals];[dimvalc];[dimxvn];[dimyvn];[colorbar];' +     \
    714       '[ckind];[clabfmt];[sminv],[smaxv];[sminc],[smaxv],[Nlev];[figt];[kindfig];' + \
    715       '[reverse];[timevals]'
     738    expectargs = '[vnamefs];[dimvals];[dimvalc];[dimxvn];[dimyvn];[dimxyfmt];' +     \
     739      '[colorbarvals];[ckind];[clabfmt];[sminv],[smaxv];[sminc],[smaxv],[Nlev];' +  \
     740      '[figt];[kindfig];[reverse];[timevals];[close]'
    716741 
    717742    drw.check_arguments(fname,values,expectargs,';')
     
    722747    vdimxn = values.split(';')[3]
    723748    vdimyn = values.split(';')[4]
    724     colbarn = values.split(';')[5]
    725     countkind = values.split(';')[6]
    726     countlabelfmt = values.split(';')[7]
    727     shadminmax = values.split(';')[8]
    728     contlevels = values.split(';')[9]
    729     figtitle = values.split(';')[10].replace('|',' ')
    730     figkind = values.split(';')[11]
    731     revals = values.split(';')[12]
    732     timevals = values.split(';')[13]
     749    dimxyfmt = values.split(';')[5]
     750    colbarvals = values.split(';')[6]
     751    countkind = values.split(';')[7]
     752    countlabelfmt = values.split(';')[8]
     753    shadminmax = values.split(';')[9]
     754    contlevels = values.split(';')[10]
     755    figtitle = values.split(';')[11].replace('|',' ')
     756    figkind = values.split(';')[12]
     757    revals = values.split(';')[13]
     758    timevals = values.split(';')[14]
     759    close = gen.Str_Bool(values.split(';')[15])
    733760
    734761    if2filenames = ncfile.find(',')
     
    852879        countlfmt = countlabelfmt
    853880
    854     shading_nx = np.zeros((2), dtype=np.float)
    855     shading_nx[0] = np.float(shadminmax.split(',')[0])
    856     shading_nx[1] = np.float(shadminmax.split(',')[1])
     881    shading_nx = []
     882    if shadminmax.split(',')[0][0:1] != 'S':
     883            shading_nx.append(np.float(shadminmax.split(',')[0]))
     884    else:
     885        shading_nx.append(shadminmax.split(',')[0])
     886
     887    if shadminmax.split(',')[1][0:1] != 'S':
     888        shading_nx.append(np.float(shadminmax.split(',')[1]))
     889    else:
     890        shading_nx.append(shadminmax.split(',')[1])
    857891
    858892    clevmin = np.float(contlevels.split(',')[0])
     
    870904        print '    generating default ones: ',levels_cont
    871905
     906    colbarn, fmtcolbar, colbaror = drw.colorbar_vals(colorbarvals,',')
     907
     908    xstyl, xaxf, Nxax, xaxor, ystyl, yaxf, Nyax, yaxor = drw.format_axes(dimxyf,',')
     909    xaxis = [xstyl, xaxf, Nxax, xaxor]
     910    yaxis = [ystyl, yaxf, Nyax, yaxor]
     911
    872912    if revals == 'None': revals = None
    873913
    874914    drw.plot_2D_shadow_contour_time(valshad, valcont, vnamesfig, ovalaxisv,         \
    875       timevals, timepos, timelabels, ovalu, timelabel, dimt, dimnamesv, colbarn,    \
    876       countkind, countlfmt, shading_nx, levels_cont, varunits, figtitle, figkind,   \
    877       revals)
     915      timevals, timepos, timelabels, ovalu, timelabel, dimt, xaxis, yaxis,          \
     916      dimnamesv, colbarn, fmtcolbar, colbaror, countkind, countlfmt, shading_nx,    \
     917      levels_cont, varunits, figtitle, figkind, revals, close)
    878918
    879919    return
     
    14291469    draw_topo_geogrid_boxes(ncfile, values)
    14301470      ncfiles= ',' list of geo_em.d[nn].nc files to use (fisrt as topographyc reference)
    1431       values= [minTopo],[maxTopo]:[lonlatL]:[title]:[graphic_kind]:[mapvalues]:[labels]:[legloc]
     1471      values= [minTopo],[maxTopo]:[lonlatL]:[title]:[graphic_kind]:[mapvalues]:[labels]:[legvals]
    14321472        [min/max]Topo: minimum and maximum values of topography to draw
    14331473        lonlatL: limits of longitudes and latitudes [lonmin, latmin, lonmax, latmax] or None
     
    14451485            * 'h', high
    14461486            * 'f', full
    1447         legloc= location of the legend (0, autmoatic)
    1448           1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
    1449           5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
    1450           9: 'upper center', 10: 'center'
     1487        [legvals]=[locleg]|[fontsize]:
     1488          [locleg]: location of the legend (0, autmoatic)
     1489            1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
     1490            5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
     1491            9: 'upper center', 10: 'center'
     1492          [fontsize]: font size for the legend (auto for 12)
    14511493        labels= labels to write in the graph
    14521494    """
     
    17111753    draw_lines(ncfilens, values, varname):
    17121754      ncfilens= [filen] ',' separated list of netCDF files
    1713       values= [dimvname]:[valuesaxis]:[dimtit]:[leglabels]:[vtit]:[title]:[locleg]:[colns]:[lines]
    1714        [points]:[lwdths]:[psizes]:[freqv]:[figname]:[graphk]
     1755      values= [dimvname]:[valuesaxis]:[dimtit]:[leglabels]:[vtit]:[title]:[legvals]:[colns]:[lines]
     1756       [points]:[lwdths]:[psizes]:[freqv]:[figname]:[graphk]:[close]
    17151757        [dimvname]: ',' list of names of the variable with he values of the common dimension
    17161758        [valuesaxis]: which axis will be used for the values ('x', or 'y')
     
    17191761        [vartit]: name of the variable in the graph
    17201762        [title]: title of the plot ('|' for spaces)
    1721         [locleg]: location of the legend (0, autmoatic)
    1722           1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
    1723           5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
    1724           9: 'upper center', 10: 'center'
     1763        [legvals]=[locleg]|[fontsize]:
     1764          [locleg]: location of the legend (0, autmoatic)
     1765            1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
     1766            5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
     1767            9: 'upper center', 10: 'center'
     1768          [fontsize]: font size for the legend (auto for 12)
    17251769        [colns]= ',' list of color names ('None' for automatic, single value for all the same)
    17261770        [lines]= ',' list of style of lines ('None' for automatic, single value for all the same)
     
    17311775        [figname]= name of the figure
    17321776        [graphk]: kind of the graphic
     1777        [close]: should figure be closed (finished)
    17331778      varname= variable to plot
    17341779      values= 'XLAT:x:latitude:32x32:$wss^{*}$:wss Taylor's turbulence term:pdf'
     
    17431788
    17441789    expectargs = '[dimvname]:[valuesaxis]:[dimtit]:[leglabels]:[vtit]:[title]:' +    \
    1745       '[locleg]:[colns]:[lines]:[points]:[lwdths]:[psizes]:[freqv]:[figname]:[graphk]'
     1790      '[legvals]:[colns]:[lines]:[points]:[lwdths]:[psizes]:[freqv]:[figname]:' +    \
     1791      '[graphk]:[close]'
    17461792    drw.check_arguments(fname,values,expectargs,':')
    17471793
     
    17531799    vartit = values.split(':')[4]
    17541800    title = values.split(':')[5].replace('|',' ')
    1755     locleg = int(values.split(':')[6])
     1801    legvals = values.split(':')[6]
    17561802    colns = gen.str_list(values.split(':')[7], ',')
    17571803    lines = gen.str_list(values.split(':')[8], ',')
     
    17621808    figname = values.split(':')[13]
    17631809    graphk = values.split(':')[14]
     1810    close = gen.Str_Bool(values.split(':')[15])
    17641811
    17651812    Nfiles = len(ncfiles)
     
    18401887        freqv = int(freqv0)
    18411888
     1889    # Legend
     1890    locleg, legfontsize = drw.legend_values(legvals,'|')
     1891
    18421892    drw.plot_lines(dimvalues, varvalues, valuesaxis, dimtit, leglabels.split(','),   \
    1843       vartit, varunits, title, locleg, colns, lines, points, lwdths, psizes, freqv,  \
    1844       figname,graphk)
     1893      vartit, varunits, title, locleg, legfontsize, colns, lines, points, lwdths,    \
     1894      psizes, freqv, figname, graphk, close)
    18451895
    18461896    return
     
    18511901      ncfilens= [filen] ',' separated list of netCDF files
    18521902      values= [dimvname];[valuesaxis];[dimtit];[leglabels];[vtit];[title];[rangevals];[timevals];
    1853         [legvals];[graphk];[collines];[points];[linewidths];[pointsizes];[pointfreq];[period]
     1903        [legvals];[graphk];[collines];[points];[linewidths];[pointsizes];[pointfreq];[period];[close]
    18541904        [dimvname]: ',' list of names of the variables with he values of the common dimension
    18551905        [valuesaxis]: which axis will be used for the values ('x', or 'y')
     
    18921942          '-1': all period
    18931943          [beg],[end]: beginning and end of the period in reference time-units of first file
     1944        [close]: Whether figure should be finished or not
    18941945      varname0= ',' list of variable names to plot (assuming only 1 variable per file)
    18951946      values= 'time;y;time ([DD]${[HH]}$);32x32;$wss^{*}$;wss Taylor's turbulence term;time|hours!since!1949-12-01_00:00:00;exct,12,h|%d$^{%H}$;2;pdf'
     
    19061957    expectargs = expectargs + '[rangevals];[timevals];[legvals];[graphk];[lines];'
    19071958    expectargs = expectargs + '[collines];[points];[linewidths];[pointsizes];'
    1908     expectargs = expectargs + '[pointfreq];[period]'
     1959    expectargs = expectargs + '[pointfreq];[period];[close]'
    19091960    drw.check_arguments(fname,values,expectargs,';')
    19101961
     
    19181969    rangevals = values.split(';')[6]
    19191970    timevals = values.split(';')[7]
    1920     legvalues = values.split(';')[8]
     1971    legvals = values.split(';')[8]
    19211972    graphk = values.split(';')[9]
    19221973    lines0 = values.split(';')[10]
     
    19271978    pointfreq0 = values.split(';')[15]
    19281979    period = values.split(';')[16]
     1980    close = gen.Str_Bool(values.split(':')[17])
    19291981
    19301982    Nfiles = len(ncfiles)
     
    20132065        if valmax != 'auto': valmax = np.float(valmax)
    20142066
    2015     locleg = int(legvalues.split('|')[0])
    2016     if legvalues.split('|')[1] == 'auto':
    2017         legfontsize = 12
    2018     else:
    2019         legfontsize = int(legvalues.split('|')[1])
     2067    # Legend
     2068    locleg, legfontsize = drw.legend_values(legvals,'|')
    20202069
    20212070# Getting values
     
    21862235    drw.plot_lines_time(dimvalues, varvalues, valuesaxis, dimtit, legvals, vartit,   \
    21872236      varunits, timepos, timelabels, title, locleg, legfontsize, graphk, valmin,     \
    2188       valmax, lines, collines, points, linewidths, pointsizes, pointfreq)
     2237      valmax, lines, collines, points, linewidths, pointsizes, pointfreq, close)
    21892238
    21902239    return
     
    24152464    """ Function to plot a series of points
    24162465      [values]= [ptasciifile]:[gtit]:[mapvalues]:[kindfigure]:[pointcolor]:[pointlabels]:
    2417         [locleg]:[figureko]:[figuren]
     2466        [legvals]:[figureko]:[figuren]
    24182467        [ptasciifile]:[file],[comchar],[collon],[collat],[lab]
    24192468          [file]: column ASCII file with the location of the points
     
    24392488        [pointcolor]: color for the points ('auto' for "red")
    24402489        [pointlabels]: ',' of labels [only used if [collab]='None'] ('None' for no labels)
    2441         [locleg]: location of the legend (0, autmoatic)
    2442           1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
    2443           5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
    2444           9: 'upper center', 10: 'center'
     2490        [legvals]=[locleg]|[fontsize]:
     2491          [locleg]: location of the legend (0, autmoatic)
     2492            1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
     2493            5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
     2494            9: 'upper center', 10: 'center'
     2495          [fontsize]: font size for the legend (auto for 12)
    24452496        [figureko]: kind of the output file (pdf, png, ...)
    24462497        [figuren]: name of the figure
     
    25792630def draw_points_lonlat(filen, values):
    25802631    """ Function to plot a series of lon/lat points
    2581      filen= name of the file
    2582      values= [lonvarname]:[latvarname]:[gkind]:[gtit]:[ptcolor]:[pttype]:[ptsize]:[labels]:[locleg]:[figureK]
    2583        [lonvarname]: name of the variable longitude
    2584        [latvarname]: name of the variable latitude
    2585        [gkind]: kind of graphical output
    2586        [gtit]: graphic title '!' for spaces
    2587        [ptcolor]: color of the points ('auto', for "red")
    2588        [pttype]: type of point
    2589        [ptsize]: size of point
    2590        [labels]: ',' list of labels to use
    2591        [locleg]: location of the legend (0, automatic)
    2592          1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
    2593          5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
    2594          9: 'upper center', 10: 'center'
    2595        [figureK]= kind of figure
    2596          'legend': only points in the map with the legend with the names
    2597          'labelled',[txtsize],[txtcol]: points with the names and size, color of text
     2632      filen= name of the file
     2633      values= [lonvarname]:[latvarname]:[gkind]:[gtit]:[ptcolor]:[pttype]:[ptsize]:[labels]:[legvals]:[figureK]
     2634        [lonvarname]: name of the variable longitude
     2635        [latvarname]: name of the variable latitude
     2636        [gkind]: kind of graphical output
     2637        [gtit]: graphic title '!' for spaces
     2638        [ptcolor]: color of the points ('auto', for "red")
     2639        [pttype]: type of point
     2640        [ptsize]: size of point
     2641        [labels]: ',' list of labels to use
     2642        [legvals]=[locleg]|[fontsize]:
     2643          [locleg]: location of the legend (0, autmoatic)
     2644            1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
     2645            5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
     2646            9: 'upper center', 10: 'center'
     2647          [fontsize]: font size for the legend (auto for 12)
     2648        [figureK]= kind of figure
     2649          'legend': only points in the map with the legend with the names
     2650          'labelled',[txtsize],[txtcol]: points with the names and size, color of text
    25982651    """
    25992652    fname = 'draw_points_lonlat'
     
    26852738def draw_timeSeries(filen, values, variables):
    26862739    """ Function to draw a time-series
    2687     draw_timeSeries(filen, values, variable):
    2688       filen= name of the file
    2689       values= [gvarname]:[timetit]:[tkind]:[timefmt]:[title]:[locleg]:[gkind]:[colorlines]:[pointtype]:[pointfreq]
    2690       [gvarname]: name of the variable to appear in the graph
    2691       [timetit]: title of the time axis (assumed x-axis, '|' for spaces)
    2692       [tkind]: kind of time to appear in the graph (assumed x-axis)
    2693         'Nval': according to a given number of values as 'Nval',[Nval]
    2694         'exct': according to an exact time unit as 'exct',[tunit];
    2695           tunit= [Nunits],[tu]; [tu]= 'c': centuries, 'y': year, 'm': month,
    2696             'w': week, 'd': day, 'h': hour, 'i': minute, 's': second,
    2697             'l': milisecond
    2698       [timefmt]: format of the time labels
    2699       [title]: title of the graphic ('|' for spaces)
    2700       [locleg]: location of the legend (0, automatic)
    2701         1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
    2702         5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
    2703         9: 'upper center', 10: 'center'
    2704       [gkind]: kind of graphical output
    2705       [colorlines]: ',' list of colors for the lines, None for automatic, single
     2740      draw_timeSeries(filen, values, variable):
     2741        filen= name of the file
     2742        values= [gvarname]:[timetit]:[tkind]:[timefmt]:[title]:[legvals]:[gkind]:[colorlines]:[pointtype]:[pointfreq]
     2743        [gvarname]: name of the variable to appear in the graph
     2744        [timetit]: title of the time axis (assumed x-axis, '|' for spaces)
     2745        [tkind]: kind of time to appear in the graph (assumed x-axis)
     2746          'Nval': according to a given number of values as 'Nval',[Nval]
     2747          'exct': according to an exact time unit as 'exct',[tunit];
     2748            tunit= [Nunits],[tu]; [tu]= 'c': centuries, 'y': year, 'm': month,
     2749              'w': week, 'd': day, 'h': hour, 'i': minute, 's': second,
     2750              'l': milisecond
     2751        [timefmt]: format of the time labels
     2752        [title]: title of the graphic ('|' for spaces)
     2753        [legvals]=[locleg]|[fontsize]:
     2754          [locleg]: location of the legend (0, autmoatic)
     2755            1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
     2756            5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
     2757            9: 'upper center', 10: 'center'
     2758          [fontsize]: font size for the legend (auto for 12)
     2759        [gkind]: kind of graphical output
     2760        [colorlines]: ',' list of colors for the lines, None for automatic, single
    27062761          value all the same
    2707       [pointtype]: ',' list of type of points for the lines, None for automatic, single
     2762        [pointtype]: ',' list of type of points for the lines, None for automatic, single
    27082763          value all the same
    2709       [pointfreq]: frequency of point plotting, 'all' for all time steps
     2764        [pointfreq]: frequency of point plotting, 'all' for all time steps
    27102765      variables= [varname],[timename] names of variable and variable with times
    27112766      draw_timeSeries('wrfout_d01_1979-12-01_00:00:00_bottom_top_B6-E6-I1_south_north_B3-E3-I1_west_east_B26-E26-I1.nc', 'dt_con:time|($[DD]^{[HH]}$):exct,12,h:$%d^{%H}$:time|evolution|at|-1|6|3|26:1:pdf', 'LDQCON,time')
     
    29743029def draw_vals_trajectories(ncfile, values, variable):
    29753030    """ Function to draw values from the outputs from 'compute_tevolboxtraj'
    2976     draw_vals_trajectories(ncfile, values, variable)
    2977     ncfile= [ncfile] ',' list of files to use
    2978     values= [statisticskind]:[Tint]:[labels]@[locleg]:[gvarname]:[timetit]:[tkind]:[timefmt]:[title]:[gkind]
    2979       [statisticskind]=[statistics][kind]
    2980         [statistics]: which statistics to use, from: 'center', 'min', 'max', 'mean',
    2981         'mean2', 'stdev'
    2982         [kind]: 'box', 'circle' statistics taking the values from a box or a circle
    2983         'trj': value following the trajectory
    2984       [Tint]: [Tbeg]@[Tend] or None, interval of time to plot or -1 for all the times
    2985       [labels]: ',' separated list of labels for the legend
    2986       [locleg]: location of the legend (0, automatic)
    2987         1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
    2988         5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
    2989         9: 'upper center', 10: 'center'
    2990       [gvarname]: name of the variable to appear in the graph
    2991       [timetit]: title of the time axis (assumed x-axis, '|' for spaces)
    2992       [tkind]: kind of time to appear in the graph (assumed x-axis)
    2993         'Nval': according to a given number of values as 'Nval',[Nval]
    2994         'exct': according to an exact time unit as 'exct',[tunit];
    2995           tunit= [Nunits],[tu]; [tu]= 'c': centuries, 'y': year, 'm': month,
    2996             'w': week, 'd': day, 'h': hour, 'i': minute, 's': second,
    2997             'l': milisecond
    2998       [timefmt]: format of the time labels
    2999       [title]: title of the graphic ('|' for spaces)
    3000       [gkind]: kind of graphical output
    3001     variable= variable to use
     3031      draw_vals_trajectories(ncfile, values, variable)
     3032      ncfile= [ncfile] ',' list of files to use
     3033      values= [statisticskind]:[Tint]:[labels]@[legvals]:[gvarname]:[timetit]:[tkind]:[timefmt]:[title]:[gkind]
     3034        [statisticskind]=[statistics][kind]
     3035          [statistics]: which statistics to use, from: 'center', 'min', 'max', 'mean',
     3036            'mean2', 'stdev'
     3037          [kind]: 'box', 'circle' statistics taking the values from a box or a circle
     3038            'trj': value following the trajectory
     3039        [Tint]: [Tbeg]@[Tend] or None, interval of time to plot or -1 for all the times
     3040        [labels]: ',' separated list of labels for the legend
     3041        [legvals]=[locleg]|[fontsize]:
     3042          [locleg]: location of the legend (0, autmoatic)
     3043            1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
     3044            5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
     3045            9: 'upper center', 10: 'center'
     3046          [fontsize]: font size for the legend (auto for 12)
     3047        [gvarname]: name of the variable to appear in the graph
     3048        [timetit]: title of the time axis (assumed x-axis, '|' for spaces)
     3049        [tkind]: kind of time to appear in the graph (assumed x-axis)
     3050          'Nval': according to a given number of values as 'Nval',[Nval]
     3051          'exct': according to an exact time unit as 'exct',[tunit];
     3052            tunit= [Nunits],[tu]; [tu]= 'c': centuries, 'y': year, 'm': month,
     3053              'w': week, 'd': day, 'h': hour, 'i': minute, 's': second,
     3054                'l': milisecond
     3055        [timefmt]: format of the time labels
     3056        [title]: title of the graphic ('|' for spaces)
     3057        [gkind]: kind of graphical output
     3058      variable= variable to use
    30023059    """
    3003 
    30043060    fname = 'draw_vals_trajectories'
    30053061
     
    36713727    """ Function to plot rivers' description from ORCHIDEE's routing scheme
    36723728      values= [dimname]|[vardimname]|[value]:[basinvals]:[upstreamvals]:[mapvalues]:
    3673         [gtit]:[kindfig]:[legloc]:[figuren]
     3729        [gtit]:[kindfig]:[legvals]:[figuren]
    36743730        'X/Y'|[dimname]|[vardimname]|[value]: ',', list for each basic dimension '|' separated of:
    36753731          [dimname]: name of the dimension in the file
     
    36943750        gtit= title of the graph ('|', for spaces)
    36953751        kindfig= kind of figure
    3696         legloc= location of the legend (0, automatic)
    3697           1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
    3698           5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
    3699           9: 'upper center', 10: 'center'      kfig= kind of figure
     3752        [legvals]=[locleg]|[fontsize]:
     3753          [locleg]: location of the legend (0, autmoatic)
     3754            1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
     3755            5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
     3756            9: 'upper center', 10: 'center'
     3757          [fontsize]: font size for the legend (auto for 12)
    37003758        figuren= name of the figure
    37013759      ncfile= file to use
     
    38493907    draw_topo_geogrid(ncfile, values, varn)
    38503908      ncfile= file to use
    3851       values= [zlogs]:[plogs]:[title]:[graphic_kind]:[legloc]
     3909      values= [zlogs]:[plogs]:[title]:[graphic_kind]:[legvals]
    38523910        zlogs= zlog,dzlog
    38533911        zlog: to use logarithmic scale on the height axis ('true/false')
     
    38583916        title: title of the graph ('!' for spaces)
    38593917        graphic_kind: kind of figure (jpg, pdf, png)
    3860         legloc= location of the legend (0, automatic)
    3861           1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
    3862           5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
    3863           9: 'upper center', 10: 'center'      kfig= kind of figure
     3918        [legvals]=[locleg]|[fontsize]:
     3919          [locleg]: location of the legend (0, autmoatic)
     3920            1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
     3921            5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
     3922            9: 'upper center', 10: 'center'
     3923          [fontsize]: font size for the legend (auto for 12)
    38643924      varn= [varnheight],[varnpres]
    38653925        varnheight: name of the variable with the height of the vertical levels
     
    40554115    """ Function to plot subbasin from 'routnig.nc' ORCDHIEE
    40564116      ncfile= file to use produced with nc_var.py#subbasin function
    4057       values= [subasiname]:[rangecolors]:[mapv]:[basinlinewidth]:[drawsubid]:[gtit]:[figkind]:[legloc]:[figurename]
     4117      values= [subasiname]:[rangecolors]:[mapv]:[basinlinewidth]:[drawsubid]:[gtit]:[figkind]:[legvals]:[figurename]
    40584118        [subasiname]= name of the subbasin ('!' for spaces)
    40594119        [rcolor]= '@', list of 'r|g|b' 1-based colors (as much as first level sub-flow). 'None' for automatic
     
    40724132        [drawsubid]= wehther sub-flow ids should be plot or not
    40734133        [graphtit]= title of the graph ('|', for spaces)
    4074         [lloc]= location of the legend (0, automatic)
    4075           1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
    4076           5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
    4077           9: 'upper center', 10: 'center'      kfig= kind of figure
     4134        [legvals]=[locleg]|[fontsize]:
     4135          [locleg]: location of the legend (0, autmoatic)
     4136            1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
     4137            5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
     4138            9: 'upper center', 10: 'center'
     4139          [fontsize]: font size for the legend (auto for 12)
    40784140        [figname]= name of the figure
    40794141    """
     
    41654227    """ Fucntion to plot two lines in different axes (x/x2 or y/y2)
    41664228      values= [commonvardim]:[varangeA]:[varangeB]:[varangeaxis]:[axisvals]:[figvarns]:[colors]:
    4167        [widths]:[styles]:[sizemarks]:[marks]:[graphtitle]:[labelaxis]:[lloc]:[figname]:[figkind]
     4229       [widths]:[styles]:[sizemarks]:[marks]:[graphtitle]:[labelaxis]:[legvals]:[figname]:[figkind]
    41684230        [commonvardim]: name of the common variable-dimension
    41694231        [varangeA]: ',' separated list of range (min,max) for A values ('None', automatic; 'Extrs' from values extremes)
     
    41804242        [graphtitle]: title of the figure ('!' for spaces)
    41814243        [labelaxis]: label in the figure of the common axis ('!' for spaces)
    4182         [lloc]: location of the legend (0, automatic)
    4183           1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
    4184           5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
    4185           9: 'upper center', 10: 'center'      kfig= kind of figure
     4244        [legvals]=[locleg]|[fontsize]:
     4245          [locleg]: location of the legend (0, autmoatic)
     4246            1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
     4247            5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
     4248            9: 'upper center', 10: 'center'
     4249          [fontsize]: font size for the legend (auto for 12)
    41864250        [figname]: name of the figure
    41874251        [figkind]: kind of figure
     
    42154279    graphtitle = values.split(':')[11].replace('!',' ')
    42164280    labelaxis = values.split(':')[12].replace('!',' ')
    4217     lloc = np.int(values.split(':')[13])
     4281    legvals = values.split(':')[13]
    42184282    figname = values.split(':')[14]
    42194283    figkind = values.split(':')[15]
     
    43274391      2, colors, styles, marks, widths, sizemarks, 'None')
    43284392
     4393    # legend
     4394    lloc, lsize = legend_values(legvals,'|')
     4395
    43294396    drw.plot_2lines(varvalsA, varvalsB, varvalsaxisA, varvalsaxisB, varangeA,        \
    43304397      varangeB, varangeaxis, axisvals, figvarns, varunits, colvalues, lwidths,       \
    4331       linekinds, psizes, pointkinds, graphtitle, labelaxis, lloc, figname, figkind)
     4398      linekinds, psizes, pointkinds, graphtitle, labelaxis, lloc, lsize, figname,    \
     4399      figkind)
    43324400
    43334401
     
    43354403    """ Function to plot two time-lines in different axes (x/x2 or y/y2)
    43364404      values= [timevardim]:[varangeA]:[varangeB]:[timeaxisfmt]:[timeaxis]:[figvarns]:[colors]:
    4337        [widths]:[styles]:[sizemarks]:[marks]:[graphtitle]:[labelaxis]:[lloc]:[figname]:[figkind]
     4405       [widths]:[styles]:[sizemarks]:[marks]:[graphtitle]:[labelaxis]:[legvals]:[figname]:[figkind]
    43384406        [timevardim]: name of the common variable-dimension time
    43394407        [varangeA]: ',' separated list of range (min,max) for A values ('None', automatic; 'Extrs' from values extremes)
     
    43564424        [graphtitle]: title of the figure ('!' for spaces)
    43574425        [labelaxis]: label in the figure of the common axis ('!' for spaces)
    4358         [lloc]: location of the legend (0, automatic)
    4359           1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
    4360           5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
    4361           9: 'upper center', 10: 'center'      kfig= kind of figure
     4426        [legvals]=[locleg]|[fontsize]:
     4427          [locleg]: location of the legend (0, autmoatic)
     4428            1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
     4429            5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
     4430            9: 'upper center', 10: 'center'
     4431          [fontsize]: font size for the legend (auto for 12)
    43624432        [figname]: name of the figure
    43634433        [figkind]: kind of figure
     
    43914461    graphtitle = values.split(':')[11].replace('!',' ')
    43924462    labelaxis = values.split(':')[12].replace('!',' ')
    4393     lloc = np.int(values.split(':')[13])
     4463    legvals = values.split(':')[13]
    43944464    figname = values.split(':')[14]
    43954465    figkind = values.split(':')[15]
     
    45024572      2, colors, styles, marks, widths, sizemarks, 'None')
    45034573
     4574    # legend
     4575    lloc, lsize = legend_values(legvals,'|')
     4576
    45044577    drw.plot_2lines_time(varvalsA, varvalsB, timevalsA, varvalsaxisB, varangeA,      \
    45054578      varangeB, tpos, tlabels, timeaxis, figvarns, varunits, colvalues, lwidths,     \
    4506       linekinds, psizes, pointkinds, graphtitle, labelaxis, lloc, figname, figkind)
     4579      linekinds, psizes, pointkinds, graphtitle, labelaxis, lloc, lsize, figname,    \
     4580      figkind)
    45074581
    45084582#quit()
  • trunk/tools/drawing_tools.py

    r1152 r1157  
    3232# format_axes: Function to provide the format for the ticks of the axes in a figure
    3333# graphic_range: Function to provide the ranges of a figure following different options
     34# legend_values: Function to determine the values for the legend
    3435# searchInlist:
    3536# datetimeStr_datetime:
     
    16961697#quit()
    16971698
    1698 
     1699def legend_values(legstring, char):
     1700    """ Function to determine the values for the legend
     1701      legstring= char separated list of [locleg][char][fontsize]:
     1702          [locleg]: location of the legend (0, autmoatic)
     1703            1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
     1704            5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
     1705            9: 'upper center', 10: 'center'
     1706          [fontsize]: font size for the legend (auto for 12)
     1707      char= separation character
     1708    """
     1709    fname = 'legend_values'
     1710
     1711    locleg = int(legstring.split('|')[0])
     1712    fontsize0 = legstring.split('|')[1]
     1713    if fontsize0 == 'auto':
     1714        fontsize = 12
     1715    else:
     1716        fontsize = int(fontsize0)
     1717
     1718    return locleg, fontsize
    16991719
    17001720#######    #######    #######    #######    #######    #######    #######    #######    #######    #######
     
    49734993    return
    49744994
    4975 def plot_2D_shadow_contour_time(varsv,varcv,vnames,valv,timv,timpos,timlab,valu,     \
    4976   timeu,axist,dimn,colorbar,ckind,clabfmt,vs,vc,uts,vtit,kfig,reva):
     4995def plot_2D_shadow_contour_time(varsv, varcv, vnames, valv, timv, timpos, timlab,    \
     4996  valu, timeu, axist, xaxv, yaxv, dimn, colorbar, cbarfmt, cbaror, ckind, clabfmt,   \
     4997  vs, vc, uts, vtit, kfig, reva, ifclose):
    49774998    """ Adding labels and other staff to the graph
    49784999      varsv= 2D values to plot with shading
     
    49865007      timeu = units at the axes which is time
    49875008      axist = which is the axis time
     5009      xaxv= list with the x-axis paramteres [style, format, number and orientation]
     5010      yaxv= list with the y-axis paramteres [style, format, number and orientation]
    49885011      dimn= dimension names to plot
    49895012      colorbar= name of the color bar to use
     5013      cbarfmt= format of the numbers in the colorbar
     5014      cbaror= orientation of the colorbar
    49905015      ckind= contour kind
    49915016        'cmap': as it gets from colorbar
     
    50015026        * 'transpose': reverse the axes (x-->y, y-->x)
    50025027        * 'flip'@[x/y]: flip the axis x or y
     5028      ifclose= boolean value whether figure should be close (finish) or not
    50035029    """
    50045030##    import matplotlib as mpl
     
    50125038        quit()
    50135039
     5040    # Check variable consistency
     5041    if len(varsv.shape) != 2:
     5042        print errormsg
     5043        print '  ' + fname + ': wrong variable shape:',varsv.shape,'is has to be 2D!!'
     5044        quit(-1)
     5045    if len(varcv.shape) != 2:
     5046        print errormsg
     5047        print '  ' + fname + ': wrong variable contour:',varcv.shape,'is has to be 2D!!'
     5048        quit(-1)
     5049
     5050    # Axis ticks
    50145051    # Usually axis > x must be the time, thus...
    5015     if axist == 'x':
    5016         dimxv0 = valv.copy()
    5017         dimyv0 = timv.copy()
    5018         dimxt0 = np.array(pretty_int(valv.min(),valv.max(),10))
    5019         dimyt0 = np.array(timpos)
    5020         dimxl0 = []
    5021         for i in range(len(dimxt0)): dimxl0.append(str(dimxt0[i]))
    5022         dimyl0 = list(timlab)
    5023         dimxT0 = variables_values(dimn[1])[0] + ' (' + units_lunits(valu) + ')'
    5024         dimyT0 = timeu
    5025     else:
    5026         dimxv0 = timv.copy()
    5027         dimyv0 = valv.copy()
    5028         dimxt0 = np.array(timpos)
    5029         dimyt0 = np.array(pretty_int(valv.min(),valv.max(),10))
    5030         dimxl0 = list(timlab)
    5031         dimyl0 = []
    5032         for i in range(len(dimyt0)): dimyl0.append(str(dimyt0[i]))
    5033         dimxT0 = timeu
    5034         dimyT0 = variables_values(dimn[0])[0] + ' (' + units_lunits(valu) + ')'
    5035 
    5036     if axist == 'x':
    5037         reva = 'transpose'
     5052    dimxv0 = timv.copy()
     5053    dimyv0 = valv.copy()
     5054
     5055    dxn = dimxv0.min()
     5056    dxx = dimxv0.max()
     5057    dyn = dimyv0.min()
     5058    dyx = dimyv0.max()
     5059
     5060    # Time ticks-labels are already given from another function
     5061    dimxt0 = np.array(timpos)
     5062    if yaxv[0] == 'pretty':
     5063        dimyt0 = np.array(pretty_int(dyn,dyx,yaxv[2]))
     5064    elif yaxv[0] == 'Nfix':
     5065        dimyt0 = np.arange(dyn,dyx,(dyx-dyn)/(1.*yaxv[2]))
     5066    elif yaxv[0] == 'Vfix':
     5067        dimyt0 = np.arange(0,dyx,yaxv[2])
     5068
     5069    dimxl0 = list(timlab)
     5070    dimyl0 = []
     5071    for i in range(len(dimyt0)): dimyl0.append('{:{style}}'.format(dimyt0[i], style=yaxv[1]))
     5072
     5073    dimxT0 = timeu
     5074    dimyT0 = variables_values(dimn[1])[0] + ' (' + units_lunits(dimyu) + ')'
     5075
     5076    # Variable values will have time variable as 0 dimension
     5077    reva = 'transpose'
     5078
     5079    if axist == 'y':
     5080        valx0 = dimyv0
     5081        valy0 = dimxv0
     5082        dimxv0 = valx0
     5083        dimyv0 = valy0
     5084
     5085        valx1 = dimyt0
     5086        valy1 = dimxt0
     5087        dimxt0 = valx1
     5088        dimyt0 = valy1
     5089
     5090        valx2 = dimyl0
     5091        valy2 = dimxl0
     5092        dimxl0 = valx2
     5093        dimyl0 = valy2
     5094
     5095        valx3 = dimyT0
     5096        valy3 = dimxT0
     5097        dimxT0 = valx3
     5098        dimyT0 = valy3
     5099
     5100        reva = None
    50385101
    50395102    if reva is not None:
     
    50565119    dy=varsv.shape[0]
    50575120
    5058     x,y = gen.lonlat2D(dimxv,dimyv)
     5121    # No following data values
     5122    #    x,y = gen.lonlat2D(dimxv,dimyv)
     5123    x = (dimxv-np.min(dimxv))/(np.max(dimxv) - np.min(dimxv))
     5124    y = (dimyv-np.min(dimyv))/(np.max(dimyv) - np.min(dimyv))
    50595125
    50605126    plt.rc('text', usetex=True)
    50615127
    5062     plt.xticks(dimxt, dimxl)
    5063     plt.yticks(dimyt, dimyl)
     5128    plt.xticks(dimxt, dimxl, rotation=xaxv[3])
     5129    plt.yticks(dimyt, dimyl, rotation=yaxv[3])
    50645130
    50655131    plt.xlim(0,dx)
     
    50675133
    50685134    plt.pcolormesh(x, y, varsv, cmap=plt.get_cmap(colorbar), vmin=vs[0], vmax=vs[1])
    5069     cbar = plt.colorbar()
     5135    if cbaror == 'horizontal':
     5136        cbar = plt.colorbar(format=cbarfmt,orientation=cbaror)
     5137        # From: http://stackoverflow.com/questions/32050030/rotation-of-colorbar-tick-labels-in-matplotlib
     5138        ticklabels= cbar.ax.get_xticklabels()
     5139        Nticks = len(ticklabels)
     5140        ticklabs = []
     5141        for itick in range(Nticks): ticklabs.append(ticklabels[itick].get_text())
     5142        cbar.ax.set_xticklabels(ticklabs,rotation=90)
     5143    else:
     5144        cbar = plt.colorbar(format=cbarfmt,orientation=cbaror)
    50705145   
    50715146# contour
     
    51015176
    51025177# units labels
    5103     cbar.set_label(vnames[0].replace('_','\_') + ' (' + units_lunits(uts[0]) + ')')
    5104     plt.annotate(vnames[1].replace('_','\_') +' (' + units_lunits(uts[1]) + ') [' +  \
     5178    cbar.set_label(gen.latex_text(vnames[0]) + ' (' + units_lunits(uts[0]) + ')')
     5179    plt.annotate(gen.latex_text(vnames[1]) +' (' + units_lunits(uts[1]) + ') [' +    \
    51055180      mincntS + ', ' + maxcntS + ']', xy=(0.55,0.04), xycoords='figure fraction',    \
    51065181      color=coln)
    51075182
    51085183    figname = '2Dfields_shadow-contour'
    5109     graphtit = vtit.replace('_','\_').replace('&','\&')
     5184    graphtit = gen.latex_text(vtit)
    51105185
    51115186    plt.title(graphtit)
    51125187   
    5113     output_kind(kfig, figname, True)
     5188    output_kind(kfig, figname, ifclose)
    51145189
    51155190    return
     
    57325807    return
    57335808
    5734 def plot_lines(vardv, varvv, vaxis, dtit, linesn, vtit, vunit, gtit, gloc, cs, ls,  \
    5735   ps, ws, ss, fv, fign, kfig):
     5809def plot_lines(vardv, varvv, vaxis, dtit, linesn, vtit, vunit, gtit, gloc, gsiz, cs, \
     5810  ls, ps, ws, ss, fv, fign, kfig, ifclose):
    57365811    """ Function to plot a collection of lines
    57375812      vardv= list of set of dimension values
     
    57475822        5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
    57485823        9: 'upper center', 10: 'center'
     5824      gsiz= fontsize of the legend
    57495825      cs= list of color names
    57505826      ls= list of style of lines
     
    57555831      fign= name of the figure
    57565832      kfig= kind of figure
     5833      ifclose= boolean value whether figure should be close (finish) or not
    57575834      plot_lines([np.arange(10)], [np.sin(np.arange(10)*np.pi/2.5)], 'y', 'time (s)',      \
    57585835  ['2.5'], 'sin', '-', 'sinus frequency dependency', 'sinus', 'pdf')
     
    58115888
    58125889    plt.title(graphtit)
    5813     plt.legend(loc=gloc)
     5890    plt.legend(loc=gloc, fontsize=gsiz)
    58145891   
    5815     output_kind(kfig, fign, True)
     5892    output_kind(kfig, fign, ifclose)
    58165893
    58175894    return
     
    60556132
    60566133def plot_lines_time(vardv, varvv, vaxis, dtit, linesn0, vtit, vunit, tpos, tlabs,    \
    6057   gtit, gloc, gsize, kfig, vmin, vmax, lsl, coll, ptl, lwidth, psize, ptf):
     6134  gtit, gloc, gsize, kfig, vmin, vmax, lsl, coll, ptl, lwidth, psize, ptf, ifclose):
    60586135    """ Function to plot a collection of lines with a time axis
    60596136      vardv= list of set of dimension values
     
    60836160      psize= ',' list of point sizes
    60846161      ptf= frequency of point plotting, 'all' for all time steps
     6162      ifclose= boolean value whether figure should be close (finish) or not
    60856163
    60866164      plot_lines([np.arange(10)], [np.sin(np.arange(10)*np.pi/2.5)], 'y', 'time (s)',      \
     
    62186296    print plt.xlim(),':', plt.ylim()
    62196297   
    6220     output_kind(kfig, figname, True)
     6298    output_kind(kfig, figname, ifclose)
    62216299
    62226300    return
     
    75187596def plot_2lines(valsA, valsB, valsaxisA, valsaxisB, rangeA, rangeB, rangeaxis,       \
    75197597  axisvals, varns, varus, cols, wdths, styls, szmks, marks, gtitle, axisn, gloc,     \
    7520   fign, figk):
     7598  sloc, fign, figk):
    75217599    """ Function to plot two lines in different axes (x/x2 or y/y2)
    75227600      valsA= values to be plotted on axis x or y
     
    75387616      axisn= label in the figure of the common axis
    75397617      gloc= location of the legend
     7618      gsiz= fontsize of the legend
    75407619      fign= name of the figure
    75417620      figk= kind of figure
     
    76077686        titleloc = (0.5,1.075)
    76087687       
    7609     graphtit = gtitle.replace('_','\_').replace('&','\&')
     7688    graphtit = gen.latex_text(gtitle)
    76107689
    76117690    plt.title(graphtit,position=titleloc)
    7612     # plt.legend([lA, lB], loc=gloc)
     7691    # plt.legend([lA, lB], loc=gloc, fontsize=gsiz)
    76137692   
    76147693    output_kind(figk, fign, True)
     
    76167695    return
    76177696
    7618 
    76197697def plot_2lines_time(valsA, valsB, valsaxisA, valsaxisB, rangeA, rangeB, valstaxis,  \
    76207698  labelstaxis, taxis, varns, varus, cols, wdths, styls, szmks, marks, gtitle, axisn, \
    7621   gloc, fign, figk):
     7699  gloc, gsize, fign, figk):
    76227700    """ Function to plot two time-lines in different axes (x/x2 or y/y2)
    76237701      valsA= values to be plotted on axis x or y
     
    76407718      axisn= label in the figure of the time axis
    76417719      gloc= location of the legend
     7720      gsiz= fontsize of the legend
    76427721      fign= name of the figure
    76437722      figk= kind of figure
     
    77147793        titleloc = (0.5,1.075)
    77157794       
    7716 #    graphtit = gtitle.replace('_','\_').replace('&','\&')
    77177795    graphtit = gen.latex_text(gtitle)
    77187796
    77197797    plt.title(graphtit,position=titleloc)
    7720     # plt.legend([lA, lB], loc=gloc)
     7798    # plt.legend([lA, lB], loc=gloc, fontsize=gsiz)
     7799
    77217800   
    77227801    output_kind(figk, fign, True)
  • trunk/tools/model_graphics.py

    r1153 r1157  
    18311831              axisvals + ':' + ','.join(CFvplot) + ':' + Aline + ',' + Bline +       \
    18321832              ':2.,2.:' + Akind + ',' + Bkind + ':2.,2.:,:' + figtit + ':' +         \
    1833               spacedim + ':0:' +  finame.replace('.'+kfig, '') + ':' + kfig
     1833              spacedim + ':0,auto:' +  finame.replace('.'+kfig, '') + ':' + kfig +   \
     1834              ':True'
    18341835
    18351836            fvarS = ','.join(vplot)
     
    18981899              timefmt + ':' + timeaxis + ':' + ','.join(CFvplot) + ':' + Aline + ',' \
    18991900              + Bline + ':2.,2.:' + Akind + ',' + Bkind + ':2.,2.:,:' + figtit + ':' \
    1900               + timelabel + ':0:' +  finame.replace('.'+kfig, '') + ':' + kfig
     1901              + timelabel + ':0,auto:' +  finame.replace('.'+kfig, '') + ':' +       \
     1902              + kfig + ':True'
    19011903
    19021904            fvarS = ','.join(vplot)
     
    19901992
    19911993            graphvals = spacedim + ':' + axisvals + ':' + sdlab + ':' + leglabels +  \
    1992               ':' + CFvplot[0] + ':' + figtit + ':0:' + lines + ':' + kinds + ':' + \
     1994              ':' + CFvplot[0] +':'+ figtit + ':0|auto:' + lines +':'+ kinds + ':' + \
    19931995              marks +':'+ sizes +':'+ sizes +':all:'+ finame.replace('.'+kfig, '') + \
    1994               ':' + kfig
     1996              ':' + kfig + ':True'
    19951997
    19961998            fvarS = vplot[0]
     
    20652067              CFvplot[0] + ';' + figtit + ';None;time|' + '|'.join(tvals) +          \
    20662068              ';0|auto;' + kfig + ';' + kinds + ';' + lines + ';' + marks + ';' +    \
    2067               sizes + ';' + sizes + ';all;-1'
     2069              sizes + ';' + sizes + ';all;-1;True'
    20682070
    20692071            fvarS = vplot[0]
     
    21652167
    21662168            graphvals = ','.join(CFvplot)
    2167             graphvals = graphvals + ';'+ dims +';'+ cbar + \
    2168               ';' + ckind + ',' + cline + ';' + cfmt + ';' + srange + ';' + crange + \
     2169            graphvals = graphvals + ';auto;'+ dims +';'+ cbar + ',auto,auto' + ';' + \
     2170              ckind + ',' + cline + ';' + cfmt + ';' + srange + ';' + crange +      \
    21692171              ',9;' + figtit + ';' + kfig + ';' + reverse + ';' + 'time|' + tunits + \
    2170               '|'+ timekind + '|' + timefmt + '|' + timelabel
     2172              '|'+ timekind + '|' + timefmt + '|' + timelabel + ';True'
    21712173
    21722174            fvarS = ','.join(vplot)
Note: See TracChangeset for help on using the changeset viewer.