Changeset 376
- Timestamp:
- 02/08/05 09:19:53 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asaplot.py
r226 r376 16 16 from matplotlib.figure import Figure, Text 17 17 from matplotlib.numerix import sqrt 18 from matplotlib import rc,rcParams 18 19 19 20 # Force use of the newfangled toolbar. … … 70 71 matplotlib.interactive = True 71 72 self.buffering = buffering 72 73 73 74 self.canvas.show() 74 75 … … 465 466 466 467 467 def set_panels(self, rows=1, cols=0, n=-1 ):468 def set_panels(self, rows=1, cols=0, n=-1, nplots=-1): 468 469 """ 469 470 Set the panel layout. … … 499 500 if i*(i-1) >= rows: i -= 1 500 501 rows = i 501 502 else: 503 if nplots > -1: 504 nel=nplots 502 505 if 0 <= n < rows*cols: 503 506 i = len(self.subplots) … … 511 514 else: 512 515 self.subplots = [] 513 for i in range( 0,nel):516 for i in range(nel): 514 517 self.subplots.append({}) 515 518 self.subplots[i]['axes'] = self.figure.add_subplot(rows, … … 589 592 """ 590 593 self.figure.text(*args, **kwargs) 591 self.show() 592 594 self.show() 593 595 594 596 def unmap(self): … … 609 611 610 612 def save(self, fname=None): 613 """ 614 Save the plot to a file. The know formats are 'png', 'ps', 'eps'. 615 Parameters: 616 filename: The name of the output file. This is optional 617 and autodetects the image format from the file 618 suffix. If non filename is specified a file 619 called 'yyyymmdd_hhmmss.png' is created in the 620 current directory. 621 """ 611 622 if fname is None: 612 623 from datetime import datetime … … 618 629 try: 619 630 self.canvas.print_figure(fname) 631 print 'Written file %s' % (fname) 620 632 except IOError, msg: 621 633 print 'Failed to save %s: Error msg was\n\n%s' % (fname, err) … … 623 635 else: 624 636 print "Invalid image type. Valid types are:" 625 print d637 print "ps, eps, png" 626 638 627 639
Note:
See TracChangeset
for help on using the changeset viewer.