Changeset 1757 for branches/alma/python/asaplotbase.py
- Timestamp:
- 06/09/10 19:03:06 (14 years ago)
- Location:
- branches/alma
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/alma
-
Property
svn:ignore
set to
.sconf_temp
.sconsign.dblite
-
Property
svn:mergeinfo
set to
/branches/asap-3.x merged eligible
-
Property
svn:ignore
set to
-
branches/alma/python/asaplotbase.py
r1723 r1757 10 10 from matplotlib.figure import Figure, Text 11 11 from matplotlib.font_manager import FontProperties as FP 12 from matplotlib.numeriximport sqrt12 from numpy import sqrt 13 13 from matplotlib import rc, rcParams 14 14 from asap import rcParams as asaprcParams 15 15 from matplotlib.ticker import OldScalarFormatter 16 from matplotlib.ticker import NullLocator17 16 18 17 # API change in mpl >= 0.98 … … 20 19 from matplotlib.transforms import blended_transform_factory 21 20 except ImportError: 22 from matplotlib.transforms import blend_xy_sep_transform 21 from matplotlib.transforms import blend_xy_sep_transform as blended_transform_factory 23 22 24 23 from asap import asaplog … … 29 28 print_log( 'WARN' ) 30 29 31 #class MyFormatter(OldScalarFormatter):32 # def __call__(self, x, pos=None):33 # last = len(self.locs)-234 # if pos==0:35 # return ''36 # else: return OldScalarFormatter.__call__(self, x, pos)37 38 30 class asaplotbase: 39 31 """ … … 41 33 """ 42 34 43 def __init__(self, rows=1, cols=0, title='', size= (8,6), buffering=False):35 def __init__(self, rows=1, cols=0, title='', size=None, buffering=False): 44 36 """ 45 37 Create a new instance of the ASAPlot plotting class. … … 157 149 fmt is the line style as in plot(). 158 150 """ 159 from matplotlib.numeriximport array160 from matplotlib.numerix.ma import MaskedArray151 from numpy import array 152 from numpy.ma import MaskedArray 161 153 if x is None: 162 154 if y is None: return … … 289 281 self.register('button_press', position_disable) 290 282 283 284 # def get_region(self): 285 # pos = [] 286 # print "Please select the bottom/left point" 287 # pos.append(self.figure.ginput(n=1, show_clicks=False)[0]) 288 # print "Please select the top/right point" 289 # pos.append(self.figure.ginput(n=1, show_clicks=False)[0]) 290 # return pos 291 292 # def get_point(self): 293 # print "Please select the point" 294 # pt = self.figure.ginput(n=1, show_clicks=False) 295 # if pt: 296 # return pt[0] 297 # else: 298 # return None 291 299 292 300 def region(self): … … 640 648 self.subplots[i]['axes'] = self.figure.add_subplot(rows, 641 649 cols, i+1) 642 if asaprcParams['plotter. xaxisformatting'] == 'mpl':650 if asaprcParams['plotter.axesformatting'] != 'mpl': 643 651 self.subplots[i]['axes'].xaxis.set_major_formatter(OldScalarFormatter()) 644 652 else: … … 646 654 self.subplots[i]['axes'] = self.figure.add_subplot(rows, 647 655 cols, i+1) 648 if asaprcParams['plotter. xaxisformatting'] != 'mpl':656 if asaprcParams['plotter.axesformatting'] != 'mpl': 649 657 650 658 self.subplots[i]['axes'].xaxis.set_major_formatter(OldScalarFormatter()) … … 730 738 731 739 from matplotlib.artist import setp 732 fp = FP(size=rcParams['xtick.labelsize']) 733 xts = fp.get_size_in_points()- (self.cols)/2 734 fp = FP(size=rcParams['ytick.labelsize']) 735 yts = fp.get_size_in_points() - (self.rows)/2 740 fpx = FP(size=rcParams['xtick.labelsize']) 741 xts = fpx.get_size_in_points()- (self.cols)/2 742 fpy = FP(size=rcParams['ytick.labelsize']) 743 yts = fpy.get_size_in_points() - (self.rows)/2 744 fpa = FP(size=rcParams['axes.labelsize']) 745 fpat = FP(size=rcParams['axes.titlesize']) 746 axsize = fpa.get_size_in_points() 747 tsize = fpat.get_size_in_points()-(self.cols)/2 736 748 for sp in self.subplots: 737 749 ax = sp['axes'] 738 #s = ax.title.get_size()739 #tsize = s-(self.cols+self.rows)740 s=FP(size=rcParams['axes.titlesize'])741 tsize = s.get_size_in_points()-(self.cols)/2742 750 ax.title.set_size(tsize) 743 fp = FP(size=rcParams['axes.labelsize'])744 751 setp(ax.get_xticklabels(), fontsize=xts) 745 752 setp(ax.get_yticklabels(), fontsize=yts) 746 origx = fp.get_size_in_points()747 origy = origx748 753 off = 0 749 754 if self.cols > 1: off = self.cols 750 xfsize = origx-off 751 ax.xaxis.label.set_size(xfsize) 755 ax.xaxis.label.set_size(axsize-off) 752 756 off = 0 753 757 if self.rows > 1: off = self.rows 754 yfsize = origy-off 755 ax.yaxis.label.set_size(yfsize) 758 ax.yaxis.label.set_size(axsize-off) 756 759 757 760 def subplot(self, i=None, inc=None):
Note: See TracChangeset
for help on using the changeset viewer.