Changeset 1479 in lmdz_wrf
- Timestamp:
- Mar 31, 2017, 4:20:04 PM (8 years ago)
- Location:
- trunk/tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/documentation/plotting/plot_points.html
r1403 r1479 52 52 [kindfigure]: kind of figure<BR> 53 53 'legend': only points in the map with the legend with the names<BR> 54 'labelled',[txtsize],[txtcol]: points with the names and size, color of text<BR> 54 'labelled',[txtsize],[txtcol],[txtbckgcol]: points with the names and size, color of text and background <BR> 55 color ('None' for without)<BR> 55 56 [pointcolor]: color for the points ('auto' for "red")<BR> 56 57 [pointlabels]: ',' of labels [only used if [collab]='None'] ('None' for no labels, '!' for spaces)<BR> … … 87 88 </DIV> 88 89 <DIV CLASS="valins"> 89 $ python ${pyHOME}/drawing.py -o draw_points -S 'SuperStorm/tslist.dat,#,3,2,1:SuperStorm|sfc|stations:auto:cyl,i:labelled,10,r :auto:None:0:png:stations_loc:True' -f 'geo_em.d02.nc,XLONG_M,XLAT_M,HGT_M,Time|0@west_east|30;180;1@south_north|175;255;1,height,0.,1500.,terrain,auto,auto,m'90 $ python ${pyHOME}/drawing.py -o draw_points -S 'SuperStorm/tslist.dat,#,3,2,1:SuperStorm|sfc|stations:auto:cyl,i:labelled,10,r,None:auto:None:0|12:png:stations_loc:True' -f 'geo_em.d02.nc,XLONG_M,XLAT_M,HGT_M,Time|0@west_east|30;180;1@south_north|175;255;1,height,0.,1500.,terrain,auto,auto,m' 90 91 </DIV> 91 92 </BODY> -
trunk/tools/drawing.py
r1476 r1479 3016 3016 [kindfigure]: kind of figure 3017 3017 'legend': only points in the map with the legend with the names 3018 'labelled',[txtsize],[txtcol]: points with the names and size, color of text 3018 'labelled',[txtsize],[txtcol],[txtbckgcol]: points with the names and size, color of text and background 3019 color ('None' for without) 3019 3020 [pointcolor]: color for the points ('auto' for "red") 3020 3021 [pointlabels]: ',' of labels [only used if [collab]='None'] ('None' for no labels, '!' for spaces) … … 3058 3059 3059 3060 expectargs = '[ptasciifile]:[gtit]:[dimxyfmt]:[mapvalues]:[kindfigure]:' + \ 3060 '[pointcolor]:[pointlabels]:[l ocleg]:[figurek]:[figuren]:[close]'3061 '[pointcolor]:[pointlabels]:[legvals]:[figurek]:[figuren]:[close]' 3061 3062 3062 3063 drw.check_arguments(fname,values,expectargs,':') … … 3069 3070 pointcolor = values.split(':')[5] 3070 3071 pointlabels = values.split(':')[6].replace('!',' ') 3071 l ocleg = int(values.split(':')[7])3072 legvalues = values.split(':')[7] 3072 3073 figureko = values.split(':')[8] 3073 3074 figuren = values.split(':')[9] … … 3233 3234 mapV = mapvalues 3234 3235 3236 # legend 3237 locleg, sizeleg = drw.legend_values(legvalues, '|') 3238 3235 3239 drw.plot_points(xptval, yptval, lonv, latv, varextra, varextrav, gtit, xaxis, \ 3236 yaxis, mapV, kindfigure, pointcolor, ptlabels, locleg, figureko, figuren, close) 3240 yaxis, mapV, kindfigure, pointcolor, ptlabels, locleg, sizeleg, figureko, \ 3241 figuren, close) 3237 3242 3238 3243 onc.close() -
trunk/tools/drawing_tools.py
r1476 r1479 3004 3004 3005 3005 def plot_points(xval, yval, vlon, vlat, extravals, extrapar, vtit, xaxv, yaxv, mapv, \ 3006 figk, color, labels, lloc, kfig, figname, ifclose):3006 figk, color, labels, lloc, gsize, kfig, figname, ifclose): 3007 3007 """ plotting points 3008 3008 [x/yval]: x,y values to plot … … 3031 3031 labels= list of labels for the points (None, no labels) 3032 3032 lloc = localisation of the legend 3033 gsize = font size of the legend 3033 3034 kfig= kind of figure (jpg, pdf, png) 3034 3035 figname= name of the figure … … 3100 3101 dimyT = dimyT0 3101 3102 3102 # C anging line kinds every 7 pts (end of standard colors)3103 # Changing line kinds every 7 pts (end of standard colors) 3103 3104 ptkinds=['.','x','o','*','+','8','>','D','h','p','s'] 3104 3105 … … 3174 3175 # Extra values 3175 3176 if extravals is not None: 3177 if len(extravals.shape) != 2: 3178 print errormsg 3179 print ' ' + fname + ': extravalues must be 2-rank !!' 3180 print ' given shape:', extravals.shape 3181 quit(-1) 3182 3176 3183 plt.pcolormesh(x, y, extravals, cmap=plt.get_cmap(extrapar[3]), \ 3177 3184 vmin=extrapar[1], vmax=extrapar[2]) … … 3191 3198 3192 3199 if labels is not None: 3193 for iv in range(len(xval)):3194 if np.mod(iv,7) == 0: N7pts = N7pts + 13195 # print iv,xval[iv],yval[iv],labels[iv],ptkinds[N7pts]3196 plt.plot(xval[iv],yval[iv], ptkinds[N7pts],label=labels[iv])3197 3198 3200 if figk[0:8] == 'labelled': 3199 if len(figk.split(',')) != 3:3201 if len(figk.split(',')) != 4: 3200 3202 print errormsg 3201 print ' ' + fname + ": 'labelled' requires t woadditional values !!"3202 print " 'labelled',[txtsize],[txtcolor] "3203 print ' ' + fname + ": 'labelled' requires three additional values !!" 3204 print " 'labelled',[txtsize],[txtcolor],[txtbckgcolor]" 3203 3205 quit(-1) 3204 3206 txtsize=int(figk.split(',')[1]) 3205 3207 txtcol=figk.split(',')[2] 3208 bcktxtcol=figk.split(',')[3] 3209 if bcktxtcol != 'None': 3210 for iv in range(len(xval)): 3211 plt.annotate(labels[iv], xy=(xval[iv],yval[iv]), xycoords='data',\ 3212 fontsize=txtsize, color=txtcol, backgroundcolor=bcktxtcol, \ 3213 zorder=2) 3214 else: 3215 for iv in range(len(xval)): 3216 plt.annotate(labels[iv], xy=(xval[iv],yval[iv]), xycoords='data',\ 3217 fontsize=txtsize, color=txtcol, zorder=2) 3206 3218 for iv in range(len(xval)): 3207 plt.annotate(labels[iv], xy=(xval[iv],yval[iv]), xycoords='data', \ 3208 fontsize=txtsize, color=txtcol) 3209 elif figk == 'legend': 3210 plt.legend(loc=lloc) 3219 if np.mod(iv,7) == 0: N7pts = N7pts + 1 3220 plt.plot(xval[iv],yval[iv], ptkinds[N7pts], color=txtcol, zorder=3) 3221 elif figk[0:6]== 'legend': 3222 for iv in range(len(xval)): 3223 if np.mod(iv,7) == 0: N7pts = N7pts + 1 3224 plt.plot(xval[iv],yval[iv], ptkinds[N7pts], label=labels[iv]) 3225 plt.legend(loc=lloc, prop={'size':gsize}) 3211 3226 3212 3227 else:
Note: See TracChangeset
for help on using the changeset viewer.