Changeset 1084 for trunk/UTIL
- Timestamp:
- Oct 29, 2013, 2:22:51 PM (11 years ago)
- Location:
- trunk/UTIL/PYTHON/planetoplot_v2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/planetoplot_v2/pp.py
r1054 r1084 72 72 parser.add_option('-U','--units',action='append',dest='units',type="string",default=None,help="units for the field") 73 73 parser.add_option('-F','--fmt',action='append',dest='fmt',type="string",default=None,help="values formatting. ex: '%.0f' '%3.1e'") 74 parser.add_option('--xcoeff',action='append',dest='xcoeff',type="float",default=None,help="multiply x axis [not for 2D map]") 75 parser.add_option('--ycoeff',action='append',dest='ycoeff',type="float",default=None,help="multiply y axis [not for 2D map]") 76 parser.add_option('--xmin',action='append',dest='xmin',type="float",default=None,help="min bound x axis [not for 2D map]") 77 parser.add_option('--ymin',action='append',dest='ymin',type="float",default=None,help="min bound y axis [not for 2D map]") 78 parser.add_option('--xmax',action='append',dest='xmax',type="float",default=None,help="max bound x axis [not for 2D map]") 79 parser.add_option('--ymax',action='append',dest='ymax',type="float",default=None,help="max bound y axis [not for 2D map]") 80 parser.add_option('--nxticks',action='append',dest='nxticks',type="float",default=None,help="ticks for x axis [not for 2D map]") 81 parser.add_option('--nyticks',action='append',dest='nyticks',type="float",default=None,help="ticks for y axis [not for 2D map]") 74 82 # -- 1D plot 75 83 parser.add_option('-L','--linestyle',action='append',dest='linestyle',type="string",default=None,help="[1D] linestyle: '-' '--' '.' '..'") … … 78 86 parser.add_option('-S','--superpose',action='store_true',dest='superpose',default=False,help="[1D] use same axis for all plots") 79 87 parser.add_option('-E','--legend',action='append',dest='legend',type="string",default=None,help="[1D] legend for line") 80 parser.add_option('--xcoeff',action='append',dest='xcoeff',type="float",default=None,help="[1D] multiply x axis")81 parser.add_option('--ycoeff',action='append',dest='ycoeff',type="float",default=None,help="[1D] multiply y axis")82 parser.add_option('--xmin',action='append',dest='xmin',type="float",default=None,help="[1D] min bound x axis")83 parser.add_option('--ymin',action='append',dest='ymin',type="float",default=None,help="[1D] min bound y axis")84 parser.add_option('--xmax',action='append',dest='xmax',type="float",default=None,help="[1D] max bound x axis")85 parser.add_option('--ymax',action='append',dest='ymax',type="float",default=None,help="[1D] max bound y axis")86 88 parser.add_option('--modx',action='append',dest='modx',type="float",default=None,help="[1D] change xticks with a modulo") 87 89 # -- 2D plot … … 97 99 parser.add_option('--svx',action='store',dest='svx',type="int",default=1,help="Define an abscissa stride on vectors only -- not on field") 98 100 parser.add_option('--svy',action='store',dest='svy',type="int",default=1,help="Define an ordinate stride on vectors only -- not on field") 101 parser.add_option('--cbticks',action='append',dest='cbticks',type="float",default=None,help="ticks for colorbar") 99 102 ########################### 100 103 (opt,args) = parser.parse_args() -
trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py
r1083 r1084 1251 1251 except: pass 1252 1252 ### 1253 try: self.p[iii].nxticks = opt.nxticks[iii] 1254 except: 1255 try: self.p[iii].nxticks = opt.nxticks[0] 1256 except: pass 1257 ### 1258 try: self.p[iii].nyticks = opt.nyticks[iii] 1259 except: 1260 try: self.p[iii].nyticks = opt.nyticks[0] 1261 except: pass 1262 ### 1263 try: self.p[iii].cbticks = opt.cbticks[iii] 1264 except: 1265 try: self.p[iii].cbticks = opt.cbticks[0] 1266 except: pass 1267 ### 1253 1268 try: self.p[iii].modx = opt.modx[iii] 1254 1269 except: -
trunk/UTIL/PYTHON/planetoplot_v2/ppplot.py
r1065 r1084 55 55 # (negative mode) 56 56 def_negative = False 57 # (xkcd mode) 58 def_xkcd = False 57 59 ############################################### 58 60 … … 66 68 mpl.rcParams['grid.color'] = 'w' 67 69 mpl.rc('savefig',facecolor='k',edgecolor='k') 70 71 ### settings for xkcd mode (only with matplotlib 1.3) 72 ### ... you must have Humori-Sans Font installed 73 if def_xkcd: 74 mpl.xkcd() 68 75 69 76 ########################## … … 363 370 nxticks=10,\ 364 371 nyticks=10,\ 372 cbticks=None,\ 365 373 title=""): 366 374 ## what could be defined by the user … … 389 397 self.nxticks = nxticks 390 398 self.nyticks = nyticks 399 self.cbticks = cbticks 391 400 ## other useful arguments 392 401 ## ... not used here in ppplot but need to be attached to plot object … … 540 549 if self.ymax is not None: y2 = self.ymax 541 550 ax.set_ybound(lower=y1,upper=y2) 542 ## set with .div the number of ticks. (is it better than automatic?)551 ## set with .div the number of ticks. 543 552 if not self.logx: 544 ax.xaxis.set_major_locator(MaxNLocator(self. div/2)) #TBD: with nxticks?553 ax.xaxis.set_major_locator(MaxNLocator(self.nxticks)) 545 554 else: 546 555 print "!! WARNING. in logx mode, ticks are set automatically." 556 if not self.logy: 557 ax.yaxis.set_major_locator(MaxNLocator(self.nyticks)) 558 else: 559 print "!! WARNING. in logy mode, ticks are set automatically." 547 560 ## specific modulo labels 548 561 if self.modx is not None: … … 714 727 else: 715 728 print "!! WARNING. in logx mode, ticks are set automatically." 729 if not self.logy: 730 ax.yaxis.set_major_locator(MaxNLocator(self.nyticks)) 731 else: 732 print "!! WARNING. in logy mode, ticks are set automatically." 716 733 ## specific modulo labels 717 734 if self.modx is not None: … … 835 852 elif self.proj in ['cyl']: orientation="vertical" ; frac = 0.023 ; pad = 0.03 ; lu = 0.5 836 853 else: orientation = zeorientation ; frac = zefrac ; pad = 0.03 ; lu = 0.5 837 zelevpal = np.linspace(zevmin,zevmax,num=min([ticks/2+1,21])) 854 if self.cbticks is None: 855 self.cbticks = min([ticks/2+1,21]) 856 zelevpal = np.linspace(zevmin,zevmax,num=self.cbticks) 838 857 zecb = mpl.colorbar(fraction=frac,pad=pad,\ 839 858 format=self.fmt,orientation=orientation,\
Note: See TracChangeset
for help on using the changeset viewer.