- Timestamp:
- 12/08/04 12:17:15 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asaplot.py
r118 r119 31 31 """ 32 32 Create a new instance of the ASAPlot plotting class. 33 34 If rows < 1 then a separate call to set_panels() is required to define 35 the panel layout; refer to the doctext for set_panels(). 33 36 """ 34 37 self.window = Tk.Tk() … … 101 104 """ 102 105 return self.attributes 106 107 108 def hist(self, x=None, y=None, fmt=None): 109 """ 110 Plot a histogram. N.B. the x values refer to the start of the 111 histogram bin. 112 113 fmt is the line style as in plot(). 114 """ 115 116 if x is None: 117 if y is None: return 118 x = range(0,len(y)) 119 120 if len(x) != len(y): 121 return 122 123 l2 = 2*len(x) 124 x2 = range(0,l2) 125 y2 = range(0,l2) 126 127 for i in range(0,l2): 128 x2[i] = x[i/2] 129 130 y2[0] = 0 131 for i in range(1,l2): 132 y2[i] = y[(i-1)/2] 133 134 self.plot(x2, y2, fmt) 103 135 104 136 … … 230 262 # Add to an existing line? 231 263 if add is None or len(self.lines) < add < 0: 264 # Don't add. 232 265 self.lines.append(line) 233 266 i = len(self.lines) - 1 … … 406 439 self.subplots[i]['lines'] = [] 407 440 408 if i == 0: self.subplot( )441 if i == 0: self.subplot(0) 409 442 410 443 else: … … 416 449 self.subplots[i]['lines'] = [] 417 450 418 self.subplot( )451 self.subplot(0) 419 452 420 453 … … 457 490 458 491 459 def subplot(self, i= 0):492 def subplot(self, i=None, inc=None): 460 493 """ 461 494 Set the subplot to the 0-relative panel number as defined by one or … … 464 497 l = len(self.subplots) 465 498 if l: 466 i = i%l 467 self.axes = self.subplots[i]['axes'] 468 self.lines = self.subplots[i]['lines'] 499 if i is not None: 500 self.i = i 501 502 if inc is not None: 503 self.i += inc 504 505 self.i %= l 506 self.axes = self.subplots[self.i]['axes'] 507 self.lines = self.subplots[self.i]['lines'] 469 508 470 509
Note:
See TracChangeset
for help on using the changeset viewer.