Changeset 1321 in lmdz_wrf for trunk/tools/generic_tools.py
- Timestamp:
- Nov 11, 2016, 7:11:26 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic_tools.py
r1320 r1321 10342 10342 fname = 'latex_fig_array' 10343 10343 10344 if type(figs) == type('s'): 10345 figs = list(figs) 10346 10344 10347 Nfig = len(figs) 10345 10348 … … 10358 10361 print " passed value of '" + dist + "' does not fit", Nfig, 'figures' 10359 10362 quit(-1) 10363 # Special case on Nfigs == 2 10364 if Nfig == 2: 10365 Ncol = 2 10366 Nrow = 1 10367 Nrest = np.mod(Nfig,Ncol) 10368 10360 10369 print ' ' + fname + ': table of figures of: ', Ncol, 'columns', Nrow, 'rows' 10361 10370 … … 10404 10413 elif irow == Nrow -1 and dorest == 'center': 10405 10414 crestS = '' 10406 for irc in range(Nrest): crestS = crestS + 'c' 10407 obf.write('\\multicolumn{'+str(Ncol)+'}{c}{\\begin{tabular}{'+crestS + \ 10408 '}\n') 10409 for icol in range(Nrest): 10410 fign = figs[iifig] 10411 print icol, fign, iifig 10412 obf.write('\\includegraphics[' + widthheight + ']{' + fign + '}\n') 10413 if icol < Nrest - 1: 10414 obf.write('&\n') 10415 else: 10416 obf.write('\\end{tabular}}\n') 10417 iifig = iifig + 1 10415 if Nrest != 0: 10416 for irc in range(Nrest): crestS = crestS + 'c' 10417 obf.write('\\multicolumn{'+str(Ncol)+'}{c}{\\begin{tabular}{' + \ 10418 crestS + '}\n') 10419 for icol in range(Nrest): 10420 fign = figs[iifig] 10421 obf.write('\\includegraphics[' + widthheight + ']{' + fign + \ 10422 '}\n') 10423 if icol < Nrest - 1: 10424 obf.write('&\n') 10425 else: 10426 obf.write('\\end{tabular}}\n') 10427 iifig = iifig + 1 10428 else: 10429 # Case with images which fulfill the last row 10430 for icol in range(Ncol): 10431 fign = figs[iifig] 10432 obf.write('\\includegraphics[' + widthheight + ']{' + fign + \ 10433 '}\n') 10434 if icol < Ncol - 1: 10435 obf.write('&\n') 10436 iifig = iifig + 1 10437 10418 10438 10419 10439 obf.write('\\end{tabular}\n') 10420 10440 else: 10441 print warnmsg 10442 print ' ' + fname + ': passed a single figure!!' 10421 10443 fign = figs[0] 10422 10444 obf.write('\\includegraphics[' + widthheight + ']{' +fign+ '}\n')
Note: See TracChangeset
for help on using the changeset viewer.