Changeset 1323 in lmdz_wrf for trunk/tools/generic_tools.py


Ignore:
Timestamp:
Nov 11, 2016, 8:46:15 PM (8 years ago)
Author:
lfita
Message:

Adding in 'latex_fig_array'

  • `refsize': refernce images size (0.9, default)
  • Flipping Ncol, Nrow distribution if Ncol < Ncol
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/generic_tools.py

    r1322 r1323  
    1029710297    return newmat, Lopn[opn]
    1029810298
    10299 def latex_fig_array(figs, obf, figcaption, figlabel, dist='sqr', width='auto',       \
    10300   height='None', dorest='nothing'):
     10299def latex_fig_array(figs, obf, figcaption, figlabel, dist='sqr', refsize=0.9,        \
     10300  width='auto', height='None', dorest='nothing'):
    1030110301    """ Function to add an array of figures to an existing tex file
    1030210302      figs= list of figures names (with path)
     
    1030710307        'sqr': squared, figures are equivenly distributed in rows and columns (sqrt(Nfigs), default)
    1030810308        [Ncol]'x'Nrow: a given number of columns and rows
     10309      refsize= refernce images size (0.9, default)
    1030910310      width= with of the figures
    1031010311        'None': no value passed
    10311         'auto': getting according to fractions of 0.9\textwidth (default)
     10312        'auto': getting according to fractions of [refsize]\textwidth (default)
    1031210313        [value]: exactly as it is desired (e.g.: '0.3\\textwidht', '5cm' ...)
    1031310314      height= height of the figures
    1031410315        'None': no value passed (default)
    10315         'auto': getting according to fractions of 0.9\textheight
     10316        'auto': getting according to fractions of [refsize]\textheight
    1031610317        [value]: exactly as it is desired (e.g.: '0.3\\textheight', '5cm' ...)
    1031710318      dorest= what to do with the last row if it does not fill the number of columns
     
    1036710368        Nrest = np.mod(Nfig,Ncol)
    1036810369
     10370    # We prefer lines of figures rather than columns
     10371    if Ncol == 1 and Nrow > 1:
     10372        vc = Ncol
     10373        vr = Nrow
     10374        Ncol = vr
     10375        Nrow = vc
     10376
    1036910377    print '  ' + fname + ': table of figures of: ', Ncol, 'columns', Nrow, 'rows'
     10378
     10379    # Checking for row/column size consistency definition
     10380    if width == 'auto' and height == 'None' and Nrow > Ncol:
     10381        print warnmsg
     10382        print '  ' + fname + ': changing autmoatic configuration !!'
     10383        print '   row-based definition of image sizes since number of rows:', Nrow,  \
     10384          'is larger than the number of columns:', Ncol
     10385        print "    from width='auto', height='None'"
     10386        print "    to width='None', height='auto'"
     10387        width = 'None'
     10388        height = 'auto'
    1037010389
    1037110390    # Width and height section
     
    1037310392    if width != 'None':
    1037410393        if width == 'auto':
    10375             sec = 0.9/Ncol
     10394            sec = np.float(refsize)/Ncol
    1037610395            widthheight = 'width=' + str(sec) + '\\textwidth'
    1037710396        else:
     
    1038110400        if len(widthheight) > 0: widthheight = widthheight + ', '
    1038210401        if height == 'auto':
    10383             sec = 0.9/Nrow
     10402            sec = np.float(refsize)/Nrow
    1038410403            widthheight = widthheight + 'height=' + str(sec) + '\\textheight'
    1038510404        else:
Note: See TracChangeset for help on using the changeset viewer.