Changeset 991 for trunk/UTIL
- Timestamp:
- Jun 14, 2013, 10:10:43 AM (12 years ago)
- Location:
- trunk/UTIL/PYTHON/planetoplot_v2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/planetoplot_v2/pp.py
r990 r991 83 83 parser.add_option('--xmax',action='append',dest='xmax',type="float",default=None,help="[1D] max bound x axis") 84 84 parser.add_option('--ymax',action='append',dest='ymax',type="float",default=None,help="[1D] max bound y axis") 85 parser.add_option('--modx',action='append',dest='modx',type="float",default=None,help="[1D] change xticks with a modulo") 85 86 # -- 2D plot 86 87 parser.add_option('-C','--colorb',action='append',dest='colorb',type="string",default=None,help="[2D] colormap: http://micropore.files.wordpress.com/2010/06/colormaps.png") -
trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py
r990 r991 162 162 units=None,\ 163 163 savtxt=False,\ 164 modx=None,\ 164 165 title=None): 165 166 self.request = None … … 201 202 self.changetime = changetime 202 203 self.savtxt = savtxt 204 self.modx = modx 203 205 ## here are user-defined plot settings 204 206 ## -- if not None, valid on all plots in the pp() objects … … 265 267 self.changetime = other.changetime 266 268 self.savtxt = other.savtxt 269 self.modx = other.modx 267 270 else: 268 271 print "!! ERROR !! argument must be a pp object." ; exit() … … 797 800 if self.units is not None: plobj.units = self.units 798 801 if self.colorb is not None: plobj.colorb = self.colorb 802 if self.modx is not None: plobj.modx = self.modx 799 803 # -- 1D specific 800 804 if dp == 1: … … 1178 1182 try: self.p[iii].ymax = opt.ymax[0] 1179 1183 except: pass 1180 1184 ### 1185 try: self.p[iii].modx = opt.modx[iii] 1186 except: 1187 try: self.p[iii].modx = opt.modx[0] 1188 except: pass 1181 1189 1182 1190 -
trunk/UTIL/PYTHON/planetoplot_v2/ppplot.py
r990 r991 248 248 return what_I_plot 249 249 250 # a function to change labels with modulo 251 # --------------------------------------- 252 def labelmodulo(ax,mod): 253 mpl.draw() 254 strtab = [] 255 for tick in ax.get_xaxis().get_ticklabels(): 256 num = float(tick.get_text()) 257 strtab.append(num % mod) 258 ax.get_xaxis().set_ticklabels(strtab) 259 return ax 260 250 261 # a function to output an ascii file 251 262 # ---------------------------------- … … 265 276 else: 266 277 print "!! WARNING !! Not printing the file, 2D fields not supported yet." 267 # mydata = np.transpose([absc,np.transpose(field)]) #tab268 # for line in mydata:269 # zeline = str(line)270 # zeline = zeline.replace('[','')271 # zeline = zeline.replace(']','')272 # myfile.write(zeline + '\n')273 278 return 274 279 … … 333 338 colorb="jet",\ 334 339 units="",\ 340 modx=None,\ 335 341 title=""): 336 342 ## what could be defined by the user … … 352 358 self.units = units 353 359 self.colorb = colorb 360 self.modx = modx 354 361 ## other useful arguments 355 362 ## ... not used here in ppplot but need to be attached to plot object … … 505 512 else: 506 513 print "!! WARNING. in logx mode, ticks are set automatically." 514 ## specific modulo labels 515 if self.modx is not None: 516 ax = labelmodulo(ax,self.modx) 507 517 508 518 ################################
Note: See TracChangeset
for help on using the changeset viewer.