Ignore:
Timestamp:
07/18/09 06:35:47 (15 years ago)
Author:
TakTsutsumi
Message:

New Development: No, merge with asap2.3.1

JIRA Issue: Yes CAS-1450

Ready to Release: Yes/No?

Interface Changes: Yes/No?

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes

Module(s): single dish

Description: Upgrade of alma branch based on ASAP2.2.0

(rev.1562) to ASAP2.3.1 (rev.1561)


File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/alma/python/asaplotbase.py

    r1446 r1603  
    1515from matplotlib.ticker import OldScalarFormatter
    1616from matplotlib.ticker import NullLocator
    17 from matplotlib.transforms import blend_xy_sep_transform
     17
     18# API change in mpl >= 0.98
     19try:
     20    from matplotlib.transforms import blended_transform_factory
     21except ImportError:
     22    from matplotlib.transforms import blend_xy_sep_transform  as blended_transform_factory
    1823
    1924if int(matplotlib.__version__.split(".")[1]) < 87:
     
    161166        y2 = range(l2)
    162167        m2 = range(l2)
    163         #ymsk = y.raw_mask()
    164         #ydat = y.raw_data()
    165         ymsk = y.mask
    166         ydat = y.data
     168        ymsk = None
     169        ydat = None
     170        if hasattr(y, "raw_mask"):
     171            # numpy < 1.1
     172            ymsk = y.raw_mask()
     173            ydat = y.raw_data()
     174        else:
     175            ymsk = y.mask
     176            ydat = y.data
    167177        for i in range(l2):
    168178            x2[i] = x[i/2]
     
    410420                if fname[-3:].lower() == ".ps":
    411421                    from matplotlib import __version__ as mv
    412                     w = self.figure.figwidth.get()
    413                     h = self.figure.figheight.get()
     422                    w = self.figure.get_figwidth()
     423                    h = self.figure.get_figheight()
    414424
    415425                    if orientation is None:
     
    428438                    ow = ds * w
    429439                    oh = ds * h
    430                     self.figure.set_figsize_inches((ow, oh))
     440                    self.figure.set_size_inches((ow, oh))
    431441                    self.figure.savefig(fname, orientation=orientation,
    432442                                        papertype=papertype.lower())
    433                     self.figure.set_figsize_inches((w, h))
     443                    self.figure.set_size_inches((w, h))
    434444                    print 'Written file %s' % (fname)
    435445                else:
     
    617627                    self.subplots[i]['axes'] = self.figure.add_subplot(rows,
    618628                                                cols, i+1)
    619                     self.subplots[i]['axes'].xaxis.set_major_formatter(OldScalarFormatter())
     629                    if asaprcParams['plotter.xaxisformatting'] == 'mpl':
     630                        self.subplots[i]['axes'].xaxis.set_major_formatter(OldScalarFormatter())
    620631                else:
    621632                    if i == 0:
    622633                        self.subplots[i]['axes'] = self.figure.add_subplot(rows,
    623634                                                cols, i+1)
    624                         self.subplots[i]['axes'].xaxis.set_major_formatter(OldScalarFormatter())
     635                        if asaprcParams['plotter.xaxisformatting'] != 'mpl':
     636                           
     637                            self.subplots[i]['axes'].xaxis.set_major_formatter(OldScalarFormatter())
    625638                    else:
    626639                        self.subplots[i]['axes'] = self.figure.add_subplot(rows,
     
    709722            for sp in self.subplots:
    710723                ax = sp['axes']
    711                 s = rcParams['axes.titlesize']
    712                 tsize = s-(self.cols+self.rows-1)
    713                 ax.title.set_size(max(tsize,9))
     724                s = ax.title.get_size()
     725                tsize = s-(self.cols+self.rows)
     726                ax.title.set_size(tsize)
    714727                fp = FP(size=rcParams['axes.labelsize'])
    715728                setp(ax.get_xticklabels(), fontsize=xts)
     
    770783        if rotate > 0.0: lbloffset = 0.03*len(label)
    771784        peakoffset = 0.01
    772         xy0 = ax.transData.xy_tup((x,y))
    773         # get relative coords
    774         xy = ax.transAxes.inverse_xy_tup(xy0)
     785        xy = None
     786        xy0 = None
     787        # matplotlib api change 0.98 is using transform now
     788        if hasattr(ax.transData, "inverse_xy_tup"):
     789            # get relative coords
     790            xy0 = ax.transData.xy_tup((x,y))
     791            xy = ax.transAxes.inverse_xy_tup(xy0)
     792        else:
     793            xy0 = ax.transData.transform((x,y))
     794            # get relative coords
     795            xy = ax.transAxes.inverted().transform(xy0)
    775796        if location.lower() == 'top':
    776797            ymax = 1.0-lbloffset
     
    783804            valign = 'top'
    784805            ylbl = ymin-0.01
    785         trans = blend_xy_sep_transform(ax.transData, ax.transAxes)
     806        trans = blended_transform_factory(ax.transData, ax.transAxes)
    786807        l = ax.axvline(x, ymin, ymax, color='black', **kwargs)
    787808        t = ax.text(x, ylbl ,label, verticalalignment=valign,
Note: See TracChangeset for help on using the changeset viewer.