Changeset 1872 in lmdz_wrf for trunk/tools
- Timestamp:
- Mar 27, 2018, 5:50:52 PM (7 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing.py
r1802 r1872 78 78 # draw_lines: Function to draw different lines at the same time from different files 79 79 # draw_lines_time: Function to draw different lines at the same time from different files with times 80 # draw_multi_2D_shad: plotting multiple 2D fields with same projection with shading and sharing colorbar 80 81 # draw_Neighbourghood_evol: Function to draw the temporal evolution of a neighbourghood around a point 81 82 # draw_points: Function to plot a series of points … … 108 109 'draw_2D_shad_line_time', 'draw_bar', 'draw_bar_line', 'draw_bar_line_time', \ 109 110 'draw_bar_time', 'draw_barbs', 'draw_basins', 'draw_cycle', 'draw_ensembles_time', \ 110 'draw_2lines', 'draw_2lines_time', 'draw_lines', 'draw_lines_time', \ 111 'draw_2lines', 'draw_2lines_time', 'draw_multi_2D_shad', 'draw_lines', \ 112 'draw_lines_time', \ 111 113 'draw_Neighbourghood_evol', \ 112 114 'draw_points', 'draw_points_lonlat', \ … … 8393 8395 return 8394 8396 8397 8398 def draw_multi_2D_shad(ncfiles, values, axfig=None, fig=None): 8399 """ plotting multiple 2D fields with same projection with shading and sharing colorbar 8400 draw_multi_2D_shad(ncfile, values, varn) 8401 ncfiles= ';' list of files to use as [filen]@[varn]@[dimvals] 8402 [filen]: name of the file 8403 [varn]: name of the variable in the file to be shaded 8404 [dimvals]: ',' list of [dimname]|[value] telling at which dimension of the 8405 variable a given value is required: 8406 * [integer]: which value of the dimension 8407 * -1: all along the dimension 8408 * -9: last value of the dimension 8409 * [beg]@[end]@[inc] slice from [beg] to [end] every [inc] 8410 * NOTE, no dim name all the dimension size 8411 values=[vnamefs]:[dimxvn]:[dimyvn]:[dimxyfmt]:[colorbarvals]:[sminv],[smaxv]: 8412 [kindfig]:[reverse]:[mapv]:[labels]:[Nrow]:[Ncol]:[globaltitle]:[close] 8413 [vnamefs]: Name in the figure of the variable to be shaded 8414 [dimx/yvn]: name of the variables with the values of the final dimensions (x,y) 8415 [dimxyfmt]=[dxs],[dxf],[Ndx],[ordx],[dys],[dyf],[Ndy],[ordx]: format of the values at each axis (or 'auto') 8416 [dxs]: style of x-axis ('auto' for 'pretty') 8417 'Nfix', values computed at even 'Ndx' 8418 'Vfix', values computed at even 'Ndx' increments 8419 'pretty', values computed following aprox. 'Ndx' at 'pretty' intervals (2.,2.5,4,5,10) 8420 [dxf]: format of the labels at the x-axis ('auto' for '%5g') 8421 [Ndx]: Number of ticks at the x-axis ('auto' for 5) 8422 [ordx]: angle of orientation of ticks at the x-axis ('auto' for horizontal) 8423 [dys]: style of y-axis ('auto' for 'pretty') 8424 [dyf]: format of the labels at the y-axis ('auto' for '%5g') 8425 [Ndy]: Number of ticks at the y-axis ('auto' for 5) 8426 [ordy]: angle of orientation of ticks at the y-axis ('auto' for horizontal) 8427 [colorbarvals]=[colbarn],[fmtcolorbar],[orientation] 8428 [colorbarn]: name of the color bar 8429 [fmtcolorbar]: format of the numbers in the color bar 'C'-like ('auto' for %6g) 8430 [orientation]: orientation of the colorbar ('vertical' (default, by 'auto'), 'horizontal') 8431 [smin/axv]: minimum and maximum value for the shading or: 8432 'Srange': for full range 8433 'Saroundmean@val': for mean-xtrm,mean+xtrm where xtrm = np.min(mean-min@val,max@val-mean) 8434 'Saroundminmax@val': for min*val,max*val 8435 'Saroundpercentile@val': for median-xtrm,median+xtrm where xtrm = np.min(median-percentile_(val), 8436 percentile_(100-val)-median) 8437 'Smean@val': for -xtrm,xtrm where xtrm = np.min(mean-min*@val,max*@val-mean) 8438 'Smedian@val': for -xtrm,xtrm where xtrm = np.min(median-min@val,max@val-median) 8439 'Spercentile@val': for -xtrm,xtrm where xtrm = np.min(median-percentile_(val), 8440 percentile_(100-val)-median) 8441 [kindfig]: kind of figure output file: png, pdf, ... 8442 [reverse]: Transformation of the values 8443 * 'transpose': reverse the axes (x-->y, y-->x) 8444 * 'flip'@[x/y]: flip the axis x or y 8445 [mapv]: map characteristics: [proj],[res] 8446 see full documentation: http://matplotlib.org/basemap/ 8447 [proj]: projection 8448 * 'cyl', cilindric 8449 * 'lcc', lambert conformal 8450 [res]: resolution: 8451 * 'c', crude 8452 * 'l', low 8453 * 'i', intermediate 8454 * 'h', high 8455 * 'f', full 8456 [labels]: ',' list of consecutive labels for each individual panel ('!' for spaces) 8457 [Nrow]: number of rows in the figure 8458 [Ncol]: number of columns in the figure 8459 [globaltitle]: global title of the figure ('!' for spaces) 8460 [close]: Whether figure should be finished or not 8461 valules= 'rh:z|-1,x|-1:z|-1,x|-1:lat:pressure:BuPu:0.,100.:rh:pdf:flip@y:None' 8462 varn= 8463 """ 8464 8465 fname = 'draw_multi_2D_shad' 8466 if values == 'h': 8467 print fname + '_____________________________________________________________' 8468 print draw_2D_shad.__doc__ 8469 quit() 8470 8471 expectargs = '[vnamefs]:[dimxvn]:[dimyvn]:[dimxyf]:[colbarvals]:' + \ 8472 '[sminv],[smaxv]:[kindfig]:[reverse]:[mapv]:[labels]:[Nrow]:[Ncol]:' + \ 8473 '[globaltitle]:[close]' 8474 8475 drw.check_arguments(fname,values,expectargs,':') 8476 8477 vnamesfig = values.split(':')[0] 8478 vdimxn = values.split(':')[1] 8479 vdimyn = values.split(':')[2] 8480 dimxyf = values.split(':')[3] 8481 colorbarvals = values.split(':')[4] 8482 shadminmax = values.split(':')[5] 8483 figkind = values.split(':')[6] 8484 revals = values.split(':')[7] 8485 mapvalue = values.split(':')[8] 8486 labels = values.split(':')[9].split(',') 8487 Nrow = int(values.split(':')[10]) 8488 Ncol = int(values.split(':')[11]) 8489 globaltitle = values.split(':')[12].replace('!', ' ') 8490 close = gen.Str_Bool(values.split(':')[13]) 8491 8492 fvds = ncfiles.split(';') 8493 lvalshad = [] 8494 8495 for fvd in fvds: 8496 ncfile = fvd.split('@')[0] 8497 varn = fvd.split('@')[1] 8498 dimvals = fvd.split('@')[2] 8499 8500 if not os.path.isfile(ncfile): 8501 print errormsg 8502 print ' ' + fname + ': shading file "' + ncfile + '" does not exist !!' 8503 quit(-1) 8504 8505 objsf = NetCDFFile(ncfile, 'r') 8506 8507 varns = varn.split(',')[0] 8508 8509 if not objsf.variables.has_key(varns): 8510 print errormsg 8511 print ' ' + fname + ': shading file "' + ncfiles + \ 8512 '" does not have variable "' + varns + '" !!' 8513 varns = sorted(objsf.variables.keys()) 8514 print ' available ones:', varns 8515 quit(-1) 8516 8517 # Variables' values 8518 objvars = objsf.variables[varns] 8519 8520 valshad, dimsshad = drw.slice_variable(objvars, \ 8521 dimvals.replace('|',':').replace(',','|')) 8522 lvalshad.append(valshad) 8523 8524 # Getting variable information from first file 8525 if fvd == fvds[0]: 8526 dimnamesv = [vdimxn, vdimyn] 8527 8528 if drw.searchInlist(objvars.ncattrs(),'units'): 8529 varunits = objvars.getncattr('units') 8530 else: 8531 print warnmsg 8532 print ' ' + fname + ": variable '" + varn + "' without units!!" 8533 varunits = '-' 8534 8535 if not objsf.variables.has_key(vdimxn): 8536 print errormsg 8537 print ' ' + fname + ': shading file "' + ncfiles + \ 8538 '" does not have dimension variable "' + vdimxn + '" !!' 8539 quit(-1) 8540 if not objsf.variables.has_key(vdimyn): 8541 print errormsg 8542 print ' ' + fname + ': shading file "' + ncfiles + \ 8543 '" does not have dimension variable "' + vdimyn + '" !!' 8544 quit(-1) 8545 8546 objdimx = objsf.variables[vdimxn] 8547 objdimy = objsf.variables[vdimyn] 8548 if drw.searchInlist(objdimx.ncattrs(),'units'): 8549 odimxu = objdimx.getncattr('units') 8550 else: 8551 print warnmsg 8552 print ' ' + fname + ": variable dimension '" + vdimxn + \ 8553 "' without units!!" 8554 odimxu = '-' 8555 8556 if drw.searchInlist(objdimy.ncattrs(),'units'): 8557 odimyu = objdimy.getncattr('units') 8558 else: 8559 print warnmsg 8560 print ' ' + fname + ": variable dimension '" + vdimyn + \ 8561 "' without units!!" 8562 odimyu = '-' 8563 8564 odimxv, odimyv = drw.dxdy_lonlatDIMS(objdimx[:], objdimy[:], \ 8565 objdimx.dimensions, objdimy.dimensions, \ 8566 dimvals.replace(':','|').split(',')) 8567 8568 shading_nx = [] 8569 if shadminmax.split(',')[0][0:1] != 'S': 8570 shading_nx.append(np.float(shadminmax.split(',')[0])) 8571 else: 8572 shading_nx.append(shadminmax.split(',')[0]) 8573 8574 if shadminmax.split(',')[1][0:1] != 'S': 8575 shading_nx.append(np.float(shadminmax.split(',')[1])) 8576 else: 8577 shading_nx.append(shadminmax.split(',')[1]) 8578 8579 if mapvalue == 'None': mapvalue = None 8580 8581 colbarn, fmtcolbar, colbaror = drw.colorbar_vals(colorbarvals,',') 8582 colormapv = [colbarn, fmtcolbar, colbaror] 8583 8584 xstyl, xaxf, Nxax, xaxor, ystyl, yaxf, Nyax, yaxor = drw.format_axes(dimxyf,',') 8585 xaxis = [xstyl, xaxf, Nxax, xaxor] 8586 yaxis = [ystyl, yaxf, Nyax, yaxor] 8587 8588 if revals == 'None': 8589 revals = None 8590 8591 drw.multi_plot_2D_shadow(lvalshad, odimxv, odimyv, odimxu, odimyu, xaxis, yaxis, \ 8592 dimnamesv, colormapv, shading_nx, varunits, figkind, revals, mapvalue, labels, \ 8593 Nrow, Ncol, globaltitle, close) 8594 8595 return 8596 #python drawing.py -o draw_multi_2D_shad -f '../PY/wrfout_d01_1995-01-01_00:00:00@T2@west_east|-1,south_north|-1,Time|0;../PY/wrfout_d01_1995-01-01_00:00:00@T2@west_east|-1,south_north|-1,Time|1;../PY/wrfout_d01_1995-01-01_00:00:00@T2@west_east|-1,south_north|-1,Time|2;../PY/wrfout_d01_1995-01-01_00:00:00@T2@west_east|-1,south_north|-1,Time|3' -S 'tas:XLONG:XLAT:auto:rainbow,auto,auto:Srange,Srange:png:None:cyl,l:0!UTC,1!UTC,2!UTC,3!UTC:2:2:tas!at!2001-11-11:True' 8597 8395 8598 #quit() 8396 8599 … … 8416 8619 'draw_2D_shad_line', 'draw_2D_shad_line_time', 'draw_2lines', 'draw_2lines_time', \ 8417 8620 'draw_bar', 'draw_bar_line', 'draw_bar_line_time', 'draw_bar_time', \ 8418 'draw_cycle', 'draw_ensembles_time', 'draw_ lines',\8621 'draw_cycle', 'draw_ensembles_time', 'draw_multi_2D_shad', 'draw_lines', \ 8419 8622 'draw_lines_time', 'draw_points', 'draw_Taylor', 'draw_time_lag', \ 8420 8623 'draw_topo_geogrid_boxes', \ … … 8504 8707 elif oper == 'draw_lines_time': 8505 8708 draw_lines_time(opts.ncfile, opts.values, opts.varname) 8709 elif oper == 'draw_multi_2D_shad': 8710 draw_multi_2D_shad(opts.ncfile, opts.values) 8506 8711 elif oper == 'draw_points': 8507 8712 draw_points(opts.ncfile, opts.values) -
trunk/tools/drawing_tools.py
r1802 r1872 10843 10843 10844 10844 return 10845 10846 def multi_plot_2D_shadow(lvarsv, dimxv, dimyv, dimxu, dimyu, xaxv, yaxv, dimn, \ 10847 cbarv, vs, uts, kfig, reva, mapv, labs, Ncol, Nrow, ftit, ifclose): 10848 """ plot of multiple 2D shadowing variables sharing colorbar 10849 lvarsv= list of 2D values to plot with shading 10850 dim[x/y]v = list of values at the axes of x and y 10851 dim[x/y]u = units at the axes of x and y 10852 xaxv= list with the x-axis paramteres [style, format, number and orientation] 10853 yaxv= list with the y-axis paramteres [style, format, number and orientation] 10854 dimn= dimension names to plot 10855 cbarv= list with the parameters of the color bar [colorbar, cbarfmt, cbaror] 10856 colorbar: name of the color bar to use 10857 cbarfmt: format of the numbers in the colorbar 10858 cbaror: orientation of the colorbar 10859 vs= minmum and maximum values to plot in shadow or: 10860 'Srange': for full range 10861 'Saroundmean@val': for mean-xtrm,mean+xtrm where xtrm = np.min(mean-min@val,max@val-mean) 10862 'Saroundminmax@val': for min*val,max*val 10863 'Saroundpercentile@val': for median-xtrm,median+xtrm where xtrm = np.min(median-percentile_(val), 10864 percentile_(100-val)-median) 10865 'Smean@val': for -xtrm,xtrm where xtrm = np.min(mean-min*@val,max*@val-mean) 10866 'Smedian@val': for -xtrm,xtrm where xtrm = np.min(median-min@val,max@val-median) 10867 'Spercentile@val': for -xtrm,xtrm where xtrm = np.min(median-percentile_(val), 10868 percentile_(100-val)-median) 10869 uts= units of the variable to shadow 10870 vtit= title of the variable 10871 kfig= kind of figure (jpg, pdf, png) 10872 reva= ('|' for combination) 10873 * 'transpose': reverse the axes (x-->y, y-->x) 10874 * 'flip'@[x/y]: flip the axis x or y 10875 mapv= map characteristics: [proj],[res] 10876 see full documentation: http://matplotlib.org/basemap/ 10877 [proj]: projection 10878 * 'cyl', cilindric 10879 * 'lcc', lambert conformal 10880 [res]: resolution: 10881 * 'c', crude 10882 * 'l', low 10883 * 'i', intermediate 10884 * 'h', high 10885 * 'f', full 10886 labs: list of consecutive labels for each figure 10887 ftit: global title of the figure 10888 Ncol: number of column panels 10889 Nrow: number of rows of panels 10890 ifclose= boolean value whether figure should be close (finish) or not 10891 """ 10892 ## import matplotlib as mpl 10893 ## mpl.use('Agg') 10894 ## import matplotlib.pyplot as plt 10895 fname = 'multi_plot_2D_shadow' 10896 10897 # print dimyv[73,21] 10898 # dimyv[73,21] = -dimyv[73,21] 10899 # print 'Lluis dimsv: ',np.min(dimxv), np.max(dimxv), ':', np.min(dimyv), np.max(dimyv) 10900 10901 if type(lvarsv) == type('S') and varsv == 'h': 10902 print fname + '_____________________________________________________________' 10903 print multi_plot_2D_shadow.__doc__ 10904 quit() 10905 10906 # Getting the right lon values for plotting 10907 if mapv is not None: 10908 dimxv = np.where(dimxv > 180., dimxv-360., dimxv) 10909 10910 # Axis ticks 10911 # Usually axis > x must be the lon, thus... 10912 dimxv0 = dimxv.copy() 10913 dimyv0 = dimyv.copy() 10914 10915 dxn = dimxv.min() 10916 dxx = dimxv.max() 10917 dyn = dimyv.min() 10918 dyx = dimyv.max() 10919 10920 if xaxv[0] == 'pretty': 10921 dimxt0 = np.array(gen.pretty_int(dxn,dxx,xaxv[2])) 10922 elif xaxv[0] == 'Nfix': 10923 dimxt0 = np.arange(dxn,dxx,(dxx-dxn)/(1.*xaxv[2])) 10924 elif xaxv[0] == 'Vfix': 10925 dimxt0 = np.arange(0,dxx,xaxv[2]) 10926 if yaxv[0] == 'pretty': 10927 dimyt0 = np.array(gen.pretty_int(dyn,dyx,yaxv[2])) 10928 elif yaxv[0] == 'Nfix': 10929 dimyt0 = np.arange(dyn,dyx,(dyx-dyn)/(1.*yaxv[2])) 10930 elif yaxv[0] == 'Vfix': 10931 dimyt0 = np.arange(0,dyx,yaxv[2]) 10932 10933 dimxl0 = [] 10934 for i in range(len(dimxt0)): dimxl0.append('{:{style}}'.format(dimxt0[i], style=xaxv[1])) 10935 dimyl0 = [] 10936 for i in range(len(dimyt0)): dimyl0.append('{:{style}}'.format(dimyt0[i], style=yaxv[1])) 10937 10938 dimxT0 = variables_values(dimn[0])[0] + ' (' + units_lunits(dimxu) + ')' 10939 dimyT0 = variables_values(dimn[1])[0] + ' (' + units_lunits(dimyu) + ')' 10940 10941 if mapv is not None: 10942 pixkind = 'data' 10943 else: 10944 # No following data values 10945 dimxt0 = np.arange(len(dimxt0),dtype=np.float)/(len(dimxt0)) 10946 dimyt0 = np.arange(len(dimyt0),dtype=np.float)/(len(dimyt0)) 10947 pixkind = 'fixpixel' 10948 10949 if reva is not None: 10950 varsv, dimxv, dimyv, dimxt, dimyt, dimxl, dimyl, dimxT, dimyT = \ 10951 transform(varsv, reva, dxv=dimxv0, dyv=dimyv0, dxt=dimxt0, dyt=dimyt0, \ 10952 dxl=dimxl0, dyl=dimyl0, dxtit=dimxT0, dytit=dimyT0) 10953 else: 10954 dimxv = dimxv0 10955 dimyv = dimyv0 10956 dimxt = dimxt0 10957 dimyt = dimyt0 10958 dimxl = dimxl0 10959 dimyl = dimyl0 10960 dimxT = dimxT0 10961 dimyT = dimyT0 10962 10963 if len(dimxv[:].shape) == 3: 10964 xdims = '1,2' 10965 elif len(dimxv[:].shape) == 2: 10966 xdims = '0,1' 10967 elif len(dimxv[:].shape) == 1: 10968 xdims = '0' 10969 10970 if len(dimyv[:].shape) == 3: 10971 ydims = '1,2' 10972 elif len(dimyv[:].shape) == 2: 10973 ydims = '0,1' 10974 elif len(dimyv[:].shape) == 1: 10975 ydims = '0' 10976 10977 lon0, lat0 = dxdy_lonlat(dimxv,dimyv, xdims, ydims) 10978 10979 if not mapv is None: 10980 map_proj=mapv.split(',')[0] 10981 map_res=mapv.split(',')[1] 10982 10983 dx = lon0.shape[1] 10984 dy = lat0.shape[0] 10985 10986 nlon = np.min(lon0) 10987 xlon = np.max(lon0) 10988 nlat = np.min(lat0) 10989 xlat = np.max(lat0) 10990 10991 lon2 = lon0[dy/2,dx/2] 10992 lat2 = lat0[dy/2,dx/2] 10993 10994 print 'lon2:', lon2, 'lat2:', lat2, 'SW pt:', nlon, ',', nlat, 'NE pt:', \ 10995 xlon, ',', xlat 10996 10997 if map_proj == 'cyl': 10998 m = Basemap(projection=map_proj, llcrnrlon=nlon, llcrnrlat=nlat, \ 10999 urcrnrlon=xlon, urcrnrlat= xlat, resolution=map_res) 11000 elif map_proj == 'lcc': 11001 m = Basemap(projection=map_proj, lat_0=lat2, lon_0=lon2, llcrnrlon=nlon, \ 11002 llcrnrlat=nlat, urcrnrlon=xlon, urcrnrlat= xlat, resolution=map_res) 11003 else: 11004 print errormsg 11005 print ' ' + fname + ": map projection '" + map_proj + "' not defined!!!" 11006 print ' available: cyl, lcc' 11007 quit(-1) 11008 11009 x,y = m(lon0,lat0) 11010 if cbarv[0] == 'gist_gray': 11011 m.drawcoastlines(color="red") 11012 else: 11013 m.drawcoastlines() 11014 meridians = gen.pretty_int(nlon,xlon,xaxv[2]) 11015 m.drawmeridians(meridians,labels=[True,False,False,True]) 11016 parallels = gen.pretty_int(nlat,xlat,yaxv[2]) 11017 m.drawparallels(parallels,labels=[False,True,True,False]) 11018 11019 else: 11020 # No following data values 11021 x = (dimxv-np.min(dimxv))/(np.max(dimxv) - np.min(dimxv)) 11022 y = (dimyv-np.min(dimyv))/(np.max(dimyv) - np.min(dimyv)) 11023 11024 # Changing limits of the colors 11025 vsend = graphic_range(vs,lvarsv) 11026 11027 # Number of panels 11028 Npanels = len(lvarsv) 11029 if Ncol*Nrow != Npanels: 11030 print errormsg 11031 print ' ' + fname + ': no coincident number of panels:', Npanels, \ 11032 'with provied distribution of them:', Ncol, Nrow 11033 11034 plt.rc('text', usetex=True) 11035 fig, axes = plt.subplots(Nrow, Ncol) 11036 11037 irow=0 11038 icol=0 11039 for iv in range(Npanels): 11040 varsv = lvarsv[iv] 11041 11042 if len(varsv.shape) != 2: 11043 print errormsg 11044 print ' ' + fname + ': wrong variable shadow rank:', varsv.shape, \ 11045 'is has to be 2D!!' 11046 quit(-1) 11047 axes[irow,icol] = plt.subplot(Nrow ,Ncol, iv+1) 11048 im = plt.pcolormesh(x, y, varsv, cmap=plt.get_cmap(cbarv[0]), vmin=vsend[0], \ 11049 vmax=vsend[1]) 11050 11051 if not mapv is None: 11052 m.drawcoastlines() 11053 m.drawmeridians(meridians,labels=[True,False,False,True]) 11054 m.drawparallels(parallels,labels=[False,True,True,False]) 11055 if irow == Nrow -1: plt.xlabel('W-E') 11056 if icol == 0: plt.ylabel('S-N') 11057 else: 11058 plt.xlabel(dimxT) 11059 plt.ylabel(dimyT) 11060 plt.xticks(dimxt, dimxl, rotation=xaxv[3]) 11061 plt.yticks(dimyt, dimyl, rotation=yaxv[3]) 11062 11063 plt.axis([x.min(), x.max(), y.min(), y.max()]) 11064 11065 graphtit = gen.latex_text(labs[iv].replace('!', ' ')) 11066 plt.title(gen.latex_text(graphtit)) 11067 icol = icol + 1 11068 if icol > Ncol-1: 11069 irow = irow + 1 11070 icol = 0 11071 11072 fig.subplots_adjust(right=0.8, hspace=0.4) 11073 cbar_ax = fig.add_axes([0.86, 0.25, 0.03, 0.50]) 11074 11075 if cbarv[2] == 'horizontal': 11076 cbar = fig.colorbar(im, cax=cbar_ax, format=cbarv[1],orientation=cbarv[2]) 11077 # From: http://stackoverflow.com/questions/32050030/rotation-of-colorbar-tick-labels-in-matplotlib 11078 ticklabels= cbar.ax.get_xticklabels() 11079 Nticks = len(ticklabels) 11080 ticklabs = [] 11081 for itick in range(Nticks): ticklabs.append(ticklabels[itick].get_text()) 11082 cbar.ax.set_xticklabels(ticklabs,rotation=90) 11083 else: 11084 cbar = fig.colorbar(im, cax=cbar_ax, format=cbarv[1],orientation=cbarv[2]) 11085 11086 #fig.colorbar(im, cax=cbar_ax) 11087 # units labels 11088 ulab = units_lunits(uts) 11089 cbar_ax.set_label(ulab) 11090 plt.annotate(ulab, xy=(0.96,0.5), xycoords='figure fraction', rotation=90) 11091 cbar_ax.tick_params(labelsize=8) 11092 11093 plt.suptitle(ftit) 11094 figname = 'multi_2Dfields_shadow' 11095 11096 output_kind(kfig, figname, ifclose) 11097 11098 return 11099
Note: See TracChangeset
for help on using the changeset viewer.