- Timestamp:
- Aug 26, 2018, 1:30:36 AM (7 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing.py
r2091 r2102 81 81 # draw_2D_shad_line_time: plotting a fields with shading and a line with time values 82 82 # draw_2D_shad_time: plotting a fields with shading with time values 83 # draw_2Dshad_map: plotting a shadow field with a background map 83 84 # draw_2lines: Fucntion to plot two lines in different axes (x/x2 or y/y2) 84 85 # draw_2lines_time: Function to plot two time-lines in different axes (x/x2 or y/y2) … … 10571 10572 #draw_WRFeta_levels(fils, vals) 10572 10573 10574 def draw_2Dshad_map(ncfile, values, varn, axfig=None, fig=None): 10575 """ plotting a shadow field with a background map 10576 draw_2Dshad_map(ncfile, values, varn) 10577 ncfile= file to use 10578 values=[vnamemap];[vnamefs];[dimvals];[dimxvn];[dimyvn];[dimxyfmt]; 10579 [colorbarvals];[sminv],[smaxv];[figt];[kindfig];[mapkind];[mapv];[close] 10580 [vnamemap]: Name of the variable to be used for map 10581 [vnamefs]: Name in the figure of the variable to be shaded 10582 [dimvals]: ',' list of [dimname]|[value] telling at which dimension of the 10583 variable a given value is required: 10584 * [integer]: which value of the dimension 10585 * -1: all along the dimension 10586 * -9: last value of the dimension 10587 * [beg]@[end]@[inc] slice from [beg] to [end] every [inc] 10588 * NOTE, no dim name all the dimension size 10589 [dimx/yvn]: name of the variables with the values of the final dimensions (x,y) 10590 [dimxyfmt]=[dxs],[dxf],[Ndx],[ordx],[dys],[dyf],[Ndy],[ordx]: format of the values at each axis (or 'auto') 10591 [dxs]: style of x-axis ('auto' for 'pretty') 10592 'Nfix', values computed at even 'Ndx' 10593 'Vfix', values computed at even 'Ndx' increments 10594 'pretty', values computed following aprox. 'Ndx' at 'pretty' intervals (2.,2.5,4,5,10) 10595 [dxf]: format of the labels at the x-axis ('auto' for '%5g') 10596 [Ndx]: Number of ticks at the x-axis ('auto' for 5) 10597 [ordx]: angle of orientation of ticks at the x-axis ('auto' for horizontal) 10598 [dys]: style of y-axis ('auto' for 'pretty') 10599 [dyf]: format of the labels at the y-axis ('auto' for '%5g') 10600 [Ndy]: Number of ticks at the y-axis ('auto' for 5) 10601 [ordy]: angle of orientation of ticks at the y-axis ('auto' for horizontal) 10602 [colorbarvals]=[colbarn]#[fmtcolorbar]#[orientation]#[colorbarticks] 10603 [colorbarn]: name of the color bar for the values to plot 10604 [fmtcolorbar]: format of the numbers in the color bar 'C'-like ('auto' for %6g) 10605 [orientation]: orientation of the colorbar ('vertical' (default, by 'auto'), 'horizontal') 10606 [colorbarticks]: kind of colorbarticks 10607 'direct': direct values 10608 'time'@[units]|[kind]|[tfmt]|[label] time labels characteristics 10609 [units]: units string according to CF conventions ([tunits] since 10610 [YYYY]-[MM]-[DD] [[HH]:[MI]:[SS]], '!' for spaces), 10611 'auto' for minutes!since!1949-12-01!00:00:00 10612 [kind]: kind of output 10613 'Nval': according to a given number of values as 'Nval',[Nval] 10614 'exct': according to an exact time unit as 'exct',[tunit]; 10615 tunit= [Nunits],[tu]; [tu]= 'c': centuries, 'y': year, 'm': month, 10616 'w': week, 'd': day, 'h': hour, 'i': minute, 's': second, 10617 'l': milisecond 10618 [tfmt]: desired format (combination of 'C'-style values and LaTeX) 10619 [label]: label at the graph ('!' for spaces, combination of 'C'-style 10620 values and LaTeX) 10621 [smin/axv]: minimum and maximum value for the shading or: 10622 'Srange': for full range 10623 'Saroundmean@val': for mean-xtrm,mean+xtrm where xtrm = np.min(mean-min@val,max@val-mean) 10624 'Saroundminmax@val': for min*val,max*val 10625 'Saroundpercentile@val': for median-xtrm,median+xtrm where xtrm = np.min(median-percentile_(val), 10626 percentile_(100-val)-median) 10627 'Smean@val': for -xtrm,xtrm where xtrm = np.min(mean-min*@val,max*@val-mean) 10628 'Smedian@val': for -xtrm,xtrm where xtrm = np.min(median-min@val,max@val-median) 10629 'Spercentile@val': for -xtrm,xtrm where xtrm = np.min(median-percentile_(val), 10630 percentile_(100-val)-median) 10631 [figt]: title of the figure ('|' for spaces) 10632 [kindfig]: kind of file for the figure output (ps, eps, png, pdf, ...) 10633 [mapfmt] = [cbarmap]|[mapkind] values for the map 10634 cbarmap: name of the colorbar for the map 10635 mapkind: kind of map to use in the plot 10636 'direct': values are they come 10637 'shadow',[pos]: pseudo-shadding from a given location of the sun 10638 [pos]: 'N', 'NW' 10639 [mapv]: map characteristics: [proj],[res] 10640 see full documentation: http://matplotlib.org/basemap/ 10641 [proj]: projection 10642 * 'cyl', cilindric 10643 * 'lcc', lambert conformal 10644 [res]: resolution: 10645 * 'c', crude 10646 * 'l', low 10647 * 'i', intermediate 10648 * 'h', high 10649 * 'f', full 10650 [close]: Whether figure should be finished or not 10651 varn= [varsn] name of the variable to plot with shading 10652 """ 10653 10654 fname = 'draw_2Dshad_map' 10655 10656 if values == 'h': 10657 print fname + '_____________________________________________________________' 10658 print draw_2Dshad_map.__doc__ 10659 quit() 10660 10661 availmapkind = ['direct', 'shadow'] 10662 availsunpos = ['N', 'NW'] 10663 10664 expectargs = '[vnamemap];[vnamefs];[dimvals];[dimxvn];[dimyvn];[dimxyfmt];' + \ 10665 '[colorbarvals];[sminv],[smaxv];[figt];[kindfig];[mapfmt];[mapv];[close]' 10666 10667 drw.check_arguments(fname,values,expectargs,';') 10668 10669 vnamemap = values.split(';')[0] 10670 vnamesfig = values.split(';')[1] 10671 dimvals= values.split(';')[2].replace('|',':') 10672 vdimxn = values.split(';')[3] 10673 vdimyn = values.split(';')[4] 10674 dimxyf = values.split(';')[5] 10675 colorbarvals = values.split(';')[6] 10676 shadminmax = values.split(';')[7] 10677 figtitle = values.split(';')[8].replace('|',' ') 10678 figkind = values.split(';')[9] 10679 mapfmt = values.split(';')[10].split('|') 10680 mapvalue = values.split(';')[11] 10681 close = gen.Str_Bool(values.split(';')[12]) 10682 10683 ncfiles = ncfile 10684 10685 if not os.path.isfile(ncfiles): 10686 print errormsg 10687 print ' ' + fname + ': shading file "' + ncfiles + '" does not exist !!' 10688 quit(-1) 10689 10690 objsf = NetCDFFile(ncfiles, 'r') 10691 10692 # Map values 10693 if not objsf.variables.has_key(vnamemap): 10694 print errormsg 10695 print ' ' + fname + ": file does not have map variable '" + vnamemap + "' !!" 10696 varns = list(objsf.variables.keys()) 10697 varns.sort() 10698 print ' available ones:', varns 10699 quit(-1) 10700 10701 omap = objsf.variables[vnamemap] 10702 valsmap, dimsmap = drw.slice_variable(omap, dimvals.replace(',','|')) 10703 if len(valsmap.shape) != 2: 10704 print errormsg 10705 print ' ' + fname + ': map values have to be 2-rank and they are:', \ 10706 len(valsmap.shape), '!!' 10707 quit(-1) 10708 10709 dx = valsmap.shape[1] 10710 dy = valsmap.shape[0] 10711 10712 mapkind = mapfmt[1] 10713 10714 if mapkind == 'direct': 10715 mapv = valsmap[:] 10716 elif mapkind[0:6] == 'shadow': 10717 mapv = np.zeros((dy,dx), dtype=np.float) 10718 sunpos = mapkind.split(',')[1] 10719 if sunpos == 'N': 10720 ## Linear shadow from N 10721 mapv[0:dy-1,:] = valsmap[1:dy,:] - valsmap[0:dy-1,:] 10722 elif sunpos == 'NW': 10723 ## Diagonal shadow from NW 10724 for i in range(dx-1): 10725 for j in range(dy-1): 10726 if (i-1 >= 0) and (j+1 <= dy-1): 10727 mapv[j,i] = valsmap[j+1,i-1] - valsmap[j,i] 10728 else: 10729 print errormsg 10730 print ' ' + fname + ": sun location for map sahdding '" + sunpos + \ 10731 "' not ready !!" 10732 print ' available ones:', availsunpos 10733 quit(-1) 10734 else: 10735 print errormsg 10736 print ' ' + fname + ": kind of map '" + mapkind + "' not ready !!" 10737 print ' available ones:', availmapkind 10738 quit(-1) 10739 10740 if not objsf.variables.has_key(varn): 10741 print errormsg 10742 print ' ' + fname + ': shading file "' + ncfiles + \ 10743 '" does not have variable "' + varn + '" !!' 10744 varns = list(objsf.variables.keys()) 10745 varns.sort() 10746 print ' available ones:', varns 10747 quit(-1) 10748 10749 # Variables' values 10750 objvars = objsf.variables[varn] 10751 if type(objvars[:]) != type(gen.mamat): 10752 print errormsg 10753 print ' ' + fname + ": drawing variable is not masked !!" 10754 quit(-1) 10755 10756 valshad, dimsshad = drw.slice_variable(objvars, dimvals.replace(',','|')) 10757 10758 dimnamesv = [vdimxn, vdimyn] 10759 10760 if drw.searchInlist(objvars.ncattrs(),'units'): 10761 varunits = objvars.getncattr('units') 10762 else: 10763 print warnmsg 10764 print ' ' + fname + ": variable '" + varn + "' without units!!" 10765 varunits = '-' 10766 10767 if not objsf.variables.has_key(vdimxn): 10768 print errormsg 10769 print ' ' + fname + ': shading file "' + ncfiles + \ 10770 '" does not have dimension variable "' + vdimxn + '" !!' 10771 quit(-1) 10772 if not objsf.variables.has_key(vdimyn): 10773 print errormsg 10774 print ' ' + fname + ': shading file "' + ncfiles + \ 10775 '" does not have dimension variable "' + vdimyn + '" !!' 10776 quit(-1) 10777 10778 objdimx = objsf.variables[vdimxn] 10779 objdimy = objsf.variables[vdimyn] 10780 if drw.searchInlist(objdimx.ncattrs(),'units'): 10781 odimxu = objdimx.getncattr('units') 10782 else: 10783 print warnmsg 10784 print ' ' + fname + ": variable dimension '" + vdimxn + "' without units!!" 10785 odimxu = '-' 10786 10787 if drw.searchInlist(objdimy.ncattrs(),'units'): 10788 odimyu = objdimy.getncattr('units') 10789 else: 10790 print warnmsg 10791 print ' ' + fname + ": variable dimension '" + vdimyn + "' without units!!" 10792 odimyu = '-' 10793 10794 odimxv, odimyv = drw.dxdy_lonlatDIMS(objdimx[:], objdimy[:], objdimx.dimensions, \ 10795 objdimy.dimensions, dimvals.replace(':','|').split(',')) 10796 10797 shading_nx = [] 10798 if shadminmax.split(',')[0][0:1] != 'S': 10799 shading_nx.append(np.float(shadminmax.split(',')[0])) 10800 else: 10801 shading_nx.append(shadminmax.split(',')[0]) 10802 10803 if shadminmax.split(',')[1][0:1] != 'S': 10804 shading_nx.append(np.float(shadminmax.split(',')[1])) 10805 else: 10806 shading_nx.append(shadminmax.split(',')[1]) 10807 10808 if mapvalue == 'None': mapvalue = None 10809 10810 colorbarv = colorbarvals.split('#') 10811 colorbarvalsS = ','.join(colorbarv[0:3]) 10812 10813 colbarn, fmtcolbar, colbaror = drw.colorbar_vals(colorbarvalsS, ',') 10814 nbarv = np.min(valshad) 10815 xbarv = np.max(valshad) 10816 rbarv = xbarv - nbarv 10817 dbarv = rbarv/5. 10818 10819 if colorbarv[3] == 'direct': 10820 cbarpos = gen.pretty_int(nbarv,xbarv+dbarv,5) 10821 cbarlab = [] 10822 for cpos in cbarpos: 10823 cbarlab.append('{:6g}'.format(cpos)) 10824 elif colorbarv[3][0:4] == 'time': 10825 print 'Lluis colorbarv', colorbarv 10826 timevals = colorbarv[3].split('@')[1] 10827 timeunit = timevals.split('|')[0].replace('!',' ') 10828 timekind = timevals.split('|')[1] 10829 timefmt = timevals.split('|')[2] 10830 timelabel = timevals.split('|')[3].replace('!',' ') 10831 cbarpos, cbarlab = drw.CFtimes_plot([nbarv, xbarv], timeunit, timekind, timefmt) 10832 vnamesfig = timelabel 10833 varunits = '-' 10834 fmtcolbar = '%s' 10835 10836 colormapv = [vnamesfig, varunits, colbarn, fmtcolbar, colbaror, cbarpos, cbarlab] 10837 10838 xstyl, xaxf, Nxax, xaxor, ystyl, yaxf, Nyax, yaxor = drw.format_axes(dimxyf,',') 10839 xaxis = [xstyl, xaxf, Nxax, xaxor] 10840 yaxis = [ystyl, yaxf, Nyax, yaxor] 10841 10842 drw.plot_2Dshad_map(mapv, valshad, mapfmt[0], colormapv, xaxis, yaxis, odimxv, \ 10843 odimyv, mapvalue, shading_nx, figtitle, figkind, close) 10844 10845 return 10846 10847 #ncfile = '/home/lluis/sandbox/get/UBA_ERA-I_1a_2D.nc' 10848 ##values='orog;$conv^{ini}$;lat|-1,lon|-1;lon;lat;auto;rainbow#auto#auto#direct;' + \ 10849 ## 'Srange,Srange;Case1|1a;pdf;binary|shadow,NW;cyl,c;yes' 10850 #values='orog;$conv^{ini}$;lat|-1,lon|-1;lon;lat;auto;rainbow#auto#auto#' + \ 10851 # 'time@minutes!since!1949-12-01!00:00:00|exct,12,h|%d$^{%H}$|date!'+ \ 10852 # '([DD]$^{[HH]}$);Srange,Srange;Case1|1a;pdf;binary|shadow,NW;cyl,c;yes' 10853 #draw_2Dshad_map(ncfile, values, 'convini', axfig=None, fig=None) 10854 10573 10855 #quit() 10574 10856 -
trunk/tools/drawing_tools.py
r2091 r2102 162 162 # plot_topo_geogrid_boxes: 163 163 # plot_2D_shadow: Plot of a 2D field with shadow 164 # plot_2Dshad_map: Function to plot a map of mask values on top of a map in shadow 164 165 # plot_2D_shadow_time: Plotting a 2D field with one of the axes being time 165 166 # plot_Neighbourghood_evol:Plotting neighbourghood evolution … … 13463 13464 #fontsize=6,fontsize=6,fontsize=6,fontsize=6 13464 13465 #prop={'size':legvs[1]}, ncol=legvs[2])prop={'size':8})prop={'size':8})prop={'size':8}) 13466 13467 def plot_2Dshad_map(mapvals, values, cbarmap, cbarv, xaxv, yaxv, dimxv, dimyv, mapv, \ 13468 vs, figtitle, figk, close): 13469 """ Function to plot a map of mask values on top of a map in shadow 13470 mapvals: 2D values to use for the map 13471 values: 2D values to plot 13472 cbarmap: cbar name for the behind map 13473 cbarv = [varn, varu, cbar, orien, fmt, poscbar, labcbar] list of values of the 13474 colorbar for the values 13475 varn: name of the variable in the plot 13476 varu: units of the vraiable 13477 orien: orientation ('vertical', 'horizontal') 13478 fmt: format of ticks labels 13479 cbar: cbar name for the values 13480 poscbar: position of the ticks of the cbar 13481 labcbar: labels of the ticks of the cbar 13482 xaxv= list with the x-axis paramteres [style, format, number and orientation] 13483 yaxv= list with the y-axis paramteres [style, format, number and orientation] 13484 dim[x/y]v: values along x/y axes 13485 mapv: values of the map 13486 vs: range of values in the figure 13487 figtitle: titile of the figure (LaTeX like) 13488 figk: kind of output file of the figure (ps, eps, png, pdf, ...) 13489 close: whether figure should be closed 13490 """ 13491 fname = 'plot_2Dshad_map' 13492 13493 if len(mapvals.shape) != 2: 13494 print errormsg 13495 print ' ' + fname + ': map values have to be 2-rank and they are:', \ 13496 len(mapvals.shape), '!!' 13497 quit(-1) 13498 13499 if len(values.shape) != 2: 13500 print errormsg 13501 print ' ' + fname + ': values have to be 2-rank and they are:', \ 13502 len(values.shape), '!!' 13503 quit(-1) 13504 13505 dimxv0 = np.array(dimxv) 13506 dimyv0 = np.array(dimyv) 13507 13508 dxn = dimxv0.min() 13509 dxx = dimxv0.max() 13510 dyn = dimyv0.min() 13511 dyx = dimyv0.max() 13512 13513 if xaxv[0] == 'pretty': 13514 dimxt0 = np.array(gen.pretty_int(dxn,dxx,xaxv[2])) 13515 elif xaxv[0] == 'Nfix': 13516 dimxt0 = np.arange(dxn,dxx,(dxx-dxn)/(1.*xaxv[2])) 13517 elif xaxv[0] == 'Vfix': 13518 dimxt0 = np.arange(0,dxx,xaxv[2]) 13519 if yaxv[0] == 'pretty': 13520 dimyt0 = np.array(gen.pretty_int(dyn,dyx,yaxv[2])) 13521 elif yaxv[0] == 'Nfix': 13522 dimyt0 = np.arange(dyn,dyx,(dyx-dyn)/(1.*yaxv[2])) 13523 elif yaxv[0] == 'Vfix': 13524 dimyt0 = np.arange(0,dyx,yaxv[2]) 13525 13526 dimxl0 = [] 13527 for i in range(len(dimxt0)): dimxl0.append('{:{style}}'.format(dimxt0[i], style=xaxv[1])) 13528 dimyl0 = [] 13529 for i in range(len(dimyt0)): dimyl0.append('{:{style}}'.format(dimyt0[i], style=yaxv[1])) 13530 13531 dimxT0 = 'x' 13532 dimyT0 = 'y' 13533 13534 vsend = graphic_range(vs, values) 13535 13536 if not mapv is None: 13537 map_proj=mapv.split(',')[0] 13538 map_res=mapv.split(',')[1] 13539 13540 lon0 = dimxv.copy() 13541 lat0 = dimyv.copy() 13542 13543 dx = lon0.shape[1] 13544 dy = lat0.shape[0] 13545 13546 nlon = np.min(lon0) 13547 xlon = np.max(lon0) 13548 nlat = np.min(lat0) 13549 xlat = np.max(lat0) 13550 13551 lon2 = lon0[dy/2,dx/2] 13552 lat2 = lat0[dy/2,dx/2] 13553 13554 print 'lon2:', lon2, 'lat2:', lat2, 'SW pt:', nlon, ',', nlat, 'NE pt:', \ 13555 xlon, ',', xlat 13556 13557 if map_proj == 'cyl': 13558 m = Basemap(projection=map_proj, llcrnrlon=nlon, llcrnrlat=nlat, \ 13559 urcrnrlon=xlon, urcrnrlat= xlat, resolution=map_res) 13560 elif map_proj == 'lcc': 13561 m = Basemap(projection=map_proj, lat_0=lat2, lon_0=lon2, llcrnrlon=nlon, \ 13562 llcrnrlat=nlat, urcrnrlon=xlon, urcrnrlat= xlat, resolution=map_res) 13563 else: 13564 print errormsg 13565 print ' ' + fname + ": map projection '" + map_proj + "' not defined!!!" 13566 print ' available: cyl, lcc' 13567 quit(-1) 13568 13569 x,y = m(lon0,lat0) 13570 13571 else: 13572 # No following data values 13573 x = (dimxv-np.min(dimxv))/(np.max(dimxv) - np.min(dimxv)) 13574 y = (dimyv-np.min(dimyv))/(np.max(dimyv) - np.min(dimyv)) 13575 13576 plt.rc('text',usetex=True) 13577 13578 # 2D continuous shaded field 13579 plt.pcolormesh(x, y, mapvals, cmap=plt.get_cmap(cbarmap)) 13580 plt.pcolormesh(x, y, values, cmap=plt.get_cmap(cbarv[2]), vmin=vsend[0], vmax=vsend[1]) 13581 13582 print 'Lluis cbarv:', cbarv 13583 13584 cbar = plt.colorbar(format=cbarv[3],orientation=cbarv[4], ticks=cbarv[5]) 13585 if cbarv[4] == 'horizontal': 13586 # From: http://stackoverflow.com/questions/32050030/rotation-of-colorbar-tick-labels-in-matplotlib 13587 cbar.ax.set_xticklabels(cbarv[6],rotation=90) 13588 else: 13589 cbar.ax.set_xticklabels(cbarv[6]) 13590 13591 if not mapv is None: 13592 if cbarv[2] == 'gist_gray': 13593 m.drawcoastlines(color="red") 13594 else: 13595 m.drawcoastlines() 13596 13597 meridians = gen.pretty_int(nlon,xlon,xaxv[2]) 13598 m.drawmeridians(meridians,labels=[True,False,False,True]) 13599 13600 parallels = gen.pretty_int(nlat,xlat,yaxv[2]) 13601 m.drawparallels(parallels,labels=[False,True,True,False]) 13602 13603 plt.xlabel('W-E') 13604 plt.ylabel('S-N') 13605 else: 13606 plt.xlabel(dimxT) 13607 plt.ylabel(dimyT) 13608 13609 if mapv is None: 13610 ldimxt = list(dimxt) 13611 ldimyt = list(dimyt) 13612 for val in ldimxt: 13613 if val < np.min(limx): ldimxt.remove(val) 13614 if val > np.max(limx): ldimxt.remove(val) 13615 for val in ldimyt: 13616 if val < np.min(limy): ldimyt.remove(val) 13617 if val > np.max(limy): ldimyt.remove(val) 13618 dimxt = np.array(ldimxt) 13619 dimyt = np.array(ldimyt) 13620 dxt = gen.interpolate_locs(dimxt,dimxv[0,:],'lin') 13621 dyt = gen.interpolate_locs(dimyt,dimyv[:,0],'lin') 13622 dimxt = dxt/varsv.shape[1] 13623 dimyt = dyt/varsv.shape[0] 13624 13625 # Using output from transform 13626 gxn = (gmaxmin[0]-xmin)/(xmax-xmin) 13627 gxx = (gmaxmin[1]-xmin)/(xmax-xmin) 13628 gyn = (gmaxmin[2]-ymin)/(ymax-ymin) 13629 gyx = (gmaxmin[3]-ymin)/(ymax-ymin) 13630 13631 #gxn = (limx[0]-xmin)/(xmax-xmin) 13632 #gxx = (limx[1]-xmin)/(xmax-xmin) 13633 #gyn = (limy[0]-ymin)/(ymax-ymin) 13634 #gyx = (limy[1]-ymin)/(ymax-ymin) 13635 13636 # Are axis flipped? 13637 signxl = np.abs(limx[0]-limx[1])/(limx[0]-limx[1]) 13638 signxt = np.abs(ldimxt[0]-ldimxt[1])/(ldimxt[0]-ldimxt[1]) 13639 signyl = np.abs(limy[0]-limy[1])/(limy[0]-limy[1]) 13640 signyt = np.abs(ldimyt[0]-ldimyt[1])/(ldimyt[0]-ldimyt[1]) 13641 13642 if signxl != signxt: 13643 plt.xticks(1.-dimxt, dimxl, rotation=xaxv[3]) 13644 else: 13645 plt.xticks(dimxt, dimxl, rotation=xaxv[3]) 13646 if signyl != signyt: 13647 plt.yticks(1.-dimyt, dimyl, rotation=yaxv[3]) 13648 else: 13649 plt.yticks(dimyt, dimyl, rotation=yaxv[3]) 13650 13651 # Only if gmaxmin is used to compute limits of the figure !! 13652 if signxl != signxt: 13653 newgxn = gxx 13654 newgxx = gxn 13655 else: 13656 newgxn = gxn 13657 newgxx = gxx 13658 if signyl != signyt: 13659 newgyn = gyx 13660 newgyx = gyn 13661 else: 13662 newgyn = gyn 13663 newgyx = gyx 13664 13665 plt.axis([newgxn, newgxx, newgyn, newgyx]) 13666 # otherwise 13667 #plt.axis([gxn, gxx, gyn, gyx]) 13668 13669 # units labels 13670 cbar.set_label(gen.latex_text(cbarv[0]) + ' (' + units_lunits(cbarv[1]) + ')') 13671 13672 plt.title(gen.latex_text(figtitle)) 13673 13674 figname = '2Dshad_map' 13675 output_kind(figk, figname, close) 13676 13677 return 13678
Note: See TracChangeset
for help on using the changeset viewer.