- Timestamp:
- 09/09/05 13:59:41 (19 years ago)
- Location:
- branches/Release-2-fixes/python
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Release-2-fixes/python/asaplot.py
r661 r671 380 380 381 381 382 def save(self, fname=None, orientation= 'landscape'):382 def save(self, fname=None, orientation=None): 383 383 """ 384 384 Save the plot to a file. … … 401 401 if fname[-3:].lower() in d: 402 402 try: 403 self.canvas.print_figure(fname,orientation=orientation) 404 print 'Written file %s' % (fname) 403 if fname[-3:].lower() == ".ps": 404 w = self.figure.figwidth.get() 405 h = self.figure.figheight.get() 406 a4w = 8.25 407 a4h = 11.25 408 409 if orientation is None: 410 # auto oriented 411 if w > h: 412 orientation = 'landscape' 413 else: 414 orientation = 'portrait' 415 ds = None 416 if orientation == 'landscape': 417 ds = min(a4h/w,a4w/h) 418 #self.figure.set_figsize_inches((a4h,a4w)) 419 else: 420 ds = min(a4w/w,a4h/h) 421 ow = ds * w 422 oh = ds * h 423 self.figure.set_figsize_inches((ow,oh)) 424 self.canvas.print_figure(fname,orientation=orientation) 425 print 'Written file %s' % (fname) 426 else: 427 self.canvas.print_figure(fname) 428 print 'Written file %s' % (fname) 405 429 except IOError, msg: 406 430 print 'Failed to save %s: Error msg was\n\n%s' % (fname, err) … … 408 432 else: 409 433 print "Invalid image type. Valid types are:" 410 print " ps, eps, png"434 print "'ps', 'eps', 'png'" 411 435 412 436 -
branches/Release-2-fixes/python/asapplotter.py
r652 r671 514 514 return 515 515 516 def save(self, filename=None, orientation= 'landscape'):516 def save(self, filename=None, orientation=None): 517 517 """ 518 518 Save the plot to a file. The know formats are 'png', 'ps', 'eps'. … … 523 523 called 'yyyymmdd_hhmmss.png' is created in the 524 524 current directory. 525 orientation: optional parameter for postscript. 'landscape' 526 (default) and 'portrait' are valid. 525 orientation: optional parameter for postscript only (not eps). 526 'landscape', 'portrait' or None (default) are valid. 527 If None is choosen for 'ps' output, the plot is 528 automatically oriented to fill the page. 527 529 """ 528 530 self._plotter.save(filename,orientation)
Note:
See TracChangeset
for help on using the changeset viewer.