Changeset 1198 in lmdz_wrf for trunk/tools
- Timestamp:
- Oct 18, 2016, 5:22:29 PM (8 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing.py
r1160 r1198 62 62 variable a given value is required (-1, all the length) 63 63 [dimx/yvn]: name of the variables with the values of the final dimensions (x,y) 64 [dimxyfmt]=[dx f],[Ndx],[dyf],[Ndy]: format of the values at each axis64 [dimxyfmt]=[dxs],[dxf],[Ndx],[ordx],[dys],[dyf],[Ndy],[ordx]: format of the values at each axis (or 'auto') 65 65 [dxs]: style of x-axis ('auto' for 'pretty') 66 66 'Nfix', values computed at even 'Ndx' 67 67 'Vfix', values computed at even 'Ndx' increments 68 68 'pretty', values computed following aprox. 'Ndx' at 'pretty' intervals (2.,2.5,4,5,10) 69 [dxf]: format of the labels at the x-axis 70 [Ndx]: Number of ticks at the x-axis 69 [dxf]: format of the labels at the x-axis ('auto' for '%5g') 70 [Ndx]: Number of ticks at the x-axis ('auto' for 5) 71 71 [ordx]: angle of orientation of ticks at the x-axis ('auto' for horizontal) 72 72 [dys]: style of y-axis ('auto' for 'pretty') 73 [dyf]: format of the labels at the y-axis 74 [Ndy]: Number of ticks at the y-axis 73 [dyf]: format of the labels at the y-axis ('auto' for '%5g') 74 [Ndy]: Number of ticks at the y-axis ('auto' for 5) 75 75 [ordy]: angle of orientation of ticks at the y-axis ('auto' for horizontal) 76 76 [colorbarvals]=[colbarn],[fmtcolorbar],[orientation] … … 97 97 [proj]: projection 98 98 * 'cyl', cilindric 99 * 'lcc', lam vbert conformal99 * 'lcc', lambert conformal 100 100 [res]: resolution: 101 101 * 'c', crude … … 220 220 221 221 colbarn, fmtcolbar, colbaror = drw.colorbar_vals(colorbarvals,',') 222 colormapv = [colbarn, fmtcolbar, colbaror] 222 223 223 224 xstyl, xaxf, Nxax, xaxor, ystyl, yaxf, Nyax, yaxor = drw.format_axes(dimxyf,',') … … 229 230 230 231 drw.plot_2D_shadow(valshad, vnamesfig, odimxv, odimyv, odimxu, odimyu, xaxis, \ 231 yaxis, dimnamesv, col barn, fmtcolbar, colbaror, shading_nx, varunits, figtitle,\232 figkind, revals,mapvalue, close)232 yaxis, dimnamesv, colormapv, shading_nx, varunits, figtitle, figkind, revals, \ 233 mapvalue, close) 233 234 234 235 return -
trunk/tools/drawing_tools.py
r1192 r1198 3928 3928 3929 3929 def plot_2D_shadow(varsv, vnames, dimxv, dimyv, dimxu, dimyu, xaxv, yaxv, dimn, \ 3930 c olorbar, cbarfmt, cbaror, vs, uts, vtit, kfig, reva, mapv, ifclose):3930 cbarv, vs, uts, vtit, kfig, reva, mapv, ifclose): 3931 3931 """ Adding labels and other staff to the graph 3932 3932 varsv= 2D values to plot with shading … … 3937 3937 yaxv= list with the y-axis paramteres [style, format, number and orientation] 3938 3938 dimn= dimension names to plot 3939 colorbar= name of the color bar to use 3940 cbarfmt= format of the numbers in the colorbar 3941 cbaror= orientation of the colorbar 3939 cbarv= list with the parameters of the color bar [colorbar, cbarfmt, cbaror] 3940 colorbar: name of the color bar to use 3941 cbarfmt: format of the numbers in the colorbar 3942 cbaror: orientation of the colorbar 3942 3943 vs= minmum and maximum values to plot in shadow or: 3943 3944 'Srange': for full range … … 4128 4129 plt.rc('text', usetex=True) 4129 4130 4130 plt.pcolormesh(x, y, varsv, cmap=plt.get_cmap(c olorbar), vmin=vsend[0], vmax=vsend[1])4131 if cbar or== 'horizontal':4132 cbar = plt.colorbar(format=cbar fmt,orientation=cbaror)4131 plt.pcolormesh(x, y, varsv, cmap=plt.get_cmap(cbarv[0]), vmin=vsend[0], vmax=vsend[1]) 4132 if cbarv[2] == 'horizontal': 4133 cbar = plt.colorbar(format=cbarv[1],orientation=cbarv[2]) 4133 4134 # From: http://stackoverflow.com/questions/32050030/rotation-of-colorbar-tick-labels-in-matplotlib 4134 4135 ticklabels= cbar.ax.get_xticklabels() … … 4138 4139 cbar.ax.set_xticklabels(ticklabs,rotation=90) 4139 4140 else: 4140 cbar = plt.colorbar(format=cbar fmt,orientation=cbaror)4141 cbar = plt.colorbar(format=cbarv[1],orientation=cbarv[2]) 4141 4142 4142 4143 if not mapv is None: 4143 if c olorbar== 'gist_gray':4144 if cbarv[0] == 'gist_gray': 4144 4145 m.drawcoastlines(color="red") 4145 4146 else: … … 4150 4151 parallels = gen.pretty_int(nlat,xlat,yaxv[2]) 4151 4152 m.drawparallels(parallels,labels=[False,True,True,False]) 4152 4153 print fname + '; Lluis nlat:', nlat, 'xlat:', xlat, 'Ny-axis:',yaxv[2]4154 print fname + '; Lluis meridians:', meridians, 'parallels:', parallels4155 4153 4156 4154 plt.xlabel('W-E')
Note: See TracChangeset
for help on using the changeset viewer.