Changeset 948 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Jun 24, 2016, 1:39:50 PM (8 years ago)
Author:
lfita
Message:

Adding legend font size in 'plot_time_lines'

Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/drawing.py

    r947 r948  
    17991799                'l': milisecond
    18001800           [tfmt]; desired format
    1801         [locleg]: location of the legend (0, autmoatic)
    1802           1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
    1803           5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
    1804           9: 'upper center', 10: 'center'
     1801        [legvals]=[locleg]|[fontsize]:
     1802          [locleg]: location of the legend (0, autmoatic)
     1803            1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
     1804            5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
     1805            9: 'upper center', 10: 'center'
     1806          [fontsize]: font size for the legend (auto for 12)
    18051807        [graphk]: kind of the graphic
    18061808        [lines]: ',' list of type of lines, None for automatic, single value all the same
     
    18411843    title = values.split(';')[5].replace('|',' ')
    18421844    timevals = values.split(';')[6]
    1843     locleg = int(values.split(';')[7])
     1845    legvalues = values.split(';')[7]
    18441846    graphk = values.split(';')[8]
    18451847    lines0 = values.split(';')[9]
     
    19261928    timekind = timevals.split('|')[2]
    19271929    timefmt = timevals.split('|')[3]
     1930
     1931    locleg = int(legvalues.split('|')[0])
     1932    if legvalues.split('|')[1] == 'auto':
     1933        legfontsize = 12
     1934    else:
     1935        legfontsize = int(legvalues.split('|')[1])
    19281936
    19291937# Getting values
     
    20932101
    20942102    drw.plot_lines_time(dimvalues, varvalues, valuesaxis, dimtit, legvals, vartit,   \
    2095       varunits, timepos, timelabels, title, locleg, graphk, lines, collines, points, \
    2096       linewidths, pointsizes, pointfreq)
     2103      varunits, timepos, timelabels, title, locleg, legfontsize, graphk, lines,      \
     2104      collines, points, linewidths, pointsizes, pointfreq)
    20972105
    20982106    return
  • trunk/tools/drawing_tools.py

    r947 r948  
    57315731
    57325732def plot_lines_time(vardv, varvv, vaxis, dtit, linesn0, vtit, vunit, tpos, tlabs,    \
    5733   gtit, gloc, kfig, lsl, coll, ptl, lwidth, psize, ptf):
     5733  gtit, gloc, gsize, kfig, lsl, coll, ptl, lwidth, psize, ptf):
    57345734    """ Function to plot a collection of lines with a time axis
    57355735      vardv= list of set of dimension values
     
    57475747        5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
    57485748        9: 'upper center', 10: 'center'
     5749      gsize= fontsize of the legend
    57495750      kfig= kind of figure
    57505751      lsl= ',' list of line styles
     
    58665867    if linesn0 is not None:
    58675868        if Ntraj < 10:
    5868             plt.legend(loc=gloc)
     5869            plt.legend(loc=gloc, prop={'size':gsize})
    58695870        elif 10 < Ntraj < 20:
    5870             plt.legend(loc=gloc, prop={'size':10})
     5871            plt.legend(loc=gloc, prop={'size':int(gsize*0.8)})
    58715872        else:
    5872             plt.legend(loc=gloc, prop={'size':8})
     5873            plt.legend(loc=gloc, prop={'size':int(gsize*0.6)})
    58735874
    58745875    print plt.xlim(),':', plt.ylim()
Note: See TracChangeset for help on using the changeset viewer.