Changeset 1476 in lmdz_wrf
- Timestamp:
- Mar 31, 2017, 3:05:59 PM (8 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing.py
r1471 r1476 2165 2165 draw_lines(ncfilens, values, varname): 2166 2166 ncfilens= [filen] ',' separated list of netCDF files 2167 values= [dimvname]:[valuesaxis]:[dimtit]:[dimxyfmt]:[ leglabels]:[vtit]:[title]:[legvals]:[colns]:[lines]2167 values= [dimvname]:[valuesaxis]:[dimtit]:[dimxyfmt]:[vrange]:[leglabels]:[vtit]:[title]:[legvals]:[colns]:[lines] 2168 2168 [points]:[lwdths]:[psizes]:[freqv]:[figname]:[graphk]:[close] 2169 2169 [dimvname]: ',' list of names of the variable with he values of the common dimension 2170 2170 [valuesaxis]: which axis will be used for the values ('x', or 'y') 2171 [dimtit]: title for the common dimension 2171 [dimtit]: title for the common dimension ('|' for spaces) 2172 2172 [dimxyfmt]=[dxs],[dxf],[Ndx],[ordx],[dys],[dyf],[Ndy],[ordx]: format of the values at each axis (or 'auto') 2173 2173 [dxs]: style of x-axis ('auto' for 'pretty') … … 2182 2182 [Ndy]: Number of ticks at the y-axis ('auto' for 5) 2183 2183 [ordy]: angle of orientation of ticks at the y-axis ('auto' for horizontal) 2184 [leglabels]: ',' separated list of names for the legend ('!' for spaces) 2184 [vrange]=[ymin],[ymax] range for the plot ('auto' for current range of values) 2185 [leglabels]: ',' separated list of names for the legend ('!' for spaces, '*' for no label) 2185 2186 [vartit]: name of the variable in the graph 2186 2187 [title]: title of the plot ('|' for spaces) … … 2211 2212 quit() 2212 2213 2213 expectargs = '[dimvname]:[valuesaxis]:[dimtit]:[dimxyfmt]:[ leglabels]:[vtit]:' +\2214 '[ title]:[legvals]:[colns]:[lines]:[points]:[lwdths]:[psizes]:[freqv]:' +\2214 expectargs = '[dimvname]:[valuesaxis]:[dimtit]:[dimxyfmt]:[vrange]:[leglabels]:'+\ 2215 '[vtit]:[title]:[legvals]:[colns]:[lines]:[points]:[lwdths]:[psizes]:[freqv]:'+\ 2215 2216 '[figname]:[graphk]:[close]' 2216 2217 drw.check_arguments(fname,values,expectargs,':') … … 2219 2220 dimvnames = values.split(':')[0] 2220 2221 valuesaxis = values.split(':')[1] 2221 dimtit = values.split(':')[2] 2222 dimtit = values.split(':')[2].replace('|', ' ') 2222 2223 dimxyfmt = values.split(':')[3] 2223 leglabels = gen.latex_text(values.split(':')[4].replace('!',' ')) 2224 vartit = values.split(':')[5] 2225 title = values.split(':')[6].replace('|',' ') 2226 legvals = values.split(':')[7] 2227 colns = gen.str_list(values.split(':')[8], ',') 2228 lines = gen.str_list(values.split(':')[9], ',') 2229 points = gen.str_list(values.split(':')[10], '@') 2230 lwdths = gen.str_list_k(values.split(':')[11], ',', 'R') 2231 psizes = gen.str_list_k(values.split(':')[12], ',', 'R') 2232 freqv0 = values.split(':')[13] 2233 figname = values.split(':')[14] 2234 graphk = values.split(':')[15] 2235 close = gen.Str_Bool(values.split(':')[16]) 2224 vrange = values.split(':')[4] 2225 leglabels = gen.latex_text(values.split(':')[5].replace('!',' ')) 2226 vartit = values.split(':')[6] 2227 title = values.split(':')[7].replace('|',' ') 2228 legvals = values.split(':')[8] 2229 colns = gen.str_list(values.split(':')[9], ',') 2230 lines = gen.str_list(values.split(':')[10], ',') 2231 points = gen.str_list(values.split(':')[11], '@') 2232 lwdths = gen.str_list_k(values.split(':')[12], ',', 'R') 2233 psizes = gen.str_list_k(values.split(':')[13], ',', 'R') 2234 freqv0 = values.split(':')[14] 2235 figname = values.split(':')[15] 2236 graphk = values.split(':')[16] 2237 close = gen.Str_Bool(values.split(':')[17]) 2236 2238 2237 2239 Nfiles = len(ncfiles) … … 2320 2322 yaxis = [ystyl, yaxf, Nyax, yaxor] 2321 2323 2322 drw.plot_lines(dimvalues, varvalues, valuesaxis, dimtit, xaxis, yaxis, \ 2324 # range 2325 if vrange == 'auto': 2326 rng = None 2327 else: 2328 rng = np.array(vrange.split(','), dtype=np.float) 2329 2330 drw.plot_lines(dimvalues, varvalues, valuesaxis, dimtit, xaxis, yaxis, rng, \ 2323 2331 leglabels.split(','), vartit, varunits, title, locleg, legfontsize, colns, \ 2324 2332 lines, points, lwdths, psizes, freqv, figname, graphk, close) -
trunk/tools/drawing_tools.py
r1475 r1476 5876 5876 return 5877 5877 5878 def plot_lines(vardv, varvv, vaxis, dtit, xaxv, yaxv, linesn, vtit, vunit, gtit,\5879 g loc, gsiz, cs, ls, ps, ws, ss, fv, fign, kfig, ifclose):5878 def plot_lines(vardv, varvv, vaxis, dtit, xaxv, yaxv, vrange, linesn, vtit, vunit, \ 5879 gtit, gloc, gsiz, cs, ls, ps, ws, ss, fv, fign, kfig, ifclose): 5880 5880 """ Function to plot a collection of lines 5881 5881 vardv= list of set of dimension values … … 5885 5885 xaxv= list with the x-axis paramteres [style, format, number and orientation] 5886 5886 yaxv= list with the y-axis paramteres [style, format, number and orientation] 5887 linesn= names for the legend 5887 vrange= range of values of the plot 5888 linesn= names for the legend ('*' for no label) 5888 5889 vtit= title for the vaxis 5889 5890 vunit= units of the vaxis … … 5917 5918 dxn = np.min(vardv) 5918 5919 dxx = np.max(vardv) 5919 dyn = np.min(varvv) 5920 dyx = np.max(varvv) 5920 if vrange is None: 5921 dyn = np.min(varvv) 5922 dyx = np.max(varvv) 5923 else: 5924 dyn = vrange[0] 5925 dyx = vrange[1] 5921 5926 5922 5927 if xaxv[0] == 'pretty': … … 5974 5979 if vaxis == 'x': 5975 5980 for il in range(Ntraj): 5976 plt.plot(varvv[il], vardv[il], lins[il], marker=pts[il], \ 5977 linewidth=lws[il], markersize=pss[il], label= linesn[il], color=cols[il]) 5981 if linesn[il] == '*': 5982 plt.plot(varvv[il], vardv[il], lins[il], marker=pts[il], \ 5983 linewidth=lws[il], markersize=pss[il], color=cols[il]) 5984 else: 5985 plt.plot(varvv[il], vardv[il], lins[il], marker=pts[il], \ 5986 linewidth=lws[il], markersize=pss[il], label=linesn[il], \ 5987 color=cols[il]) 5978 5988 5979 5989 plt.xlim(dyn,dyx) … … 5982 5992 else: 5983 5993 for il in range(Ntraj): 5984 plt.plot(vardv[il], varvv[il], lins[il], marker=pts[il], \ 5985 linewidth=lws[il], markersize=pss[il], label= linesn[il], color=cols[il]) 5994 if linesn[il] == '*': 5995 plt.plot(vardv[il], varvv[il], lins[il], marker=pts[il], \ 5996 linewidth=lws[il], markersize=pss[il], color=cols[il]) 5997 else: 5998 plt.plot(vardv[il], varvv[il], lins[il], marker=pts[il], \ 5999 linewidth=lws[il], markersize=pss[il], label=linesn[il], \ 6000 color=cols[il]) 6001 5986 6002 5987 6003 plt.xlim(dxn,dxx)
Note: See TracChangeset
for help on using the changeset viewer.