Changeset 671 for branches/Release-2-fixes/python/asaplot.py
- Timestamp:
- 09/09/05 13:59:41 (19 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.