Ignore:
Timestamp:
06/09/10 19:03:06 (14 years ago)
Author:
Kana Sugimoto
Message:

New Development: Yes

JIRA Issue: Yes (CAS-2211)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: ASAP 3.0.0 interface changes

Test Programs:

Put in Release Notes: Yes

Module(s): all the CASA sd tools and tasks are affected.

Description: Merged ATNF-ASAP 3.0.0 developments to CASA (alma) branch.

Note you also need to update casa/code/atnf.


Location:
branches/alma
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/alma

  • branches/alma/python/asaplotbase.py

    r1723 r1757  
    1010from matplotlib.figure import Figure, Text
    1111from matplotlib.font_manager import FontProperties as FP
    12 from matplotlib.numerix import sqrt
     12from numpy import sqrt
    1313from matplotlib import rc, rcParams
    1414from asap import rcParams as asaprcParams
    1515from matplotlib.ticker import OldScalarFormatter
    16 from matplotlib.ticker import NullLocator
    1716
    1817# API change in mpl >= 0.98
     
    2019    from matplotlib.transforms import blended_transform_factory
    2120except ImportError:
    22     from matplotlib.transforms import blend_xy_sep_transform  as blended_transform_factory
     21    from matplotlib.transforms import blend_xy_sep_transform as blended_transform_factory
    2322
    2423from asap import asaplog
     
    2928    print_log( 'WARN' )
    3029
    31 #class MyFormatter(OldScalarFormatter):
    32 #    def __call__(self, x, pos=None):
    33 #        last = len(self.locs)-2
    34 #        if pos==0:
    35 #            return ''
    36 #        else: return OldScalarFormatter.__call__(self, x, pos)
    37 
    3830class asaplotbase:
    3931    """
     
    4133    """
    4234
    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):
    4436        """
    4537        Create a new instance of the ASAPlot plotting class.
     
    157149        fmt is the line style as in plot().
    158150        """
    159         from matplotlib.numerix import array
    160         from matplotlib.numerix.ma import MaskedArray
     151        from numpy import array
     152        from numpy.ma import MaskedArray
    161153        if x is None:
    162154            if y is None: return
     
    289281        self.register('button_press', position_disable)
    290282
     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
    291299
    292300    def region(self):
     
    640648                    self.subplots[i]['axes'] = self.figure.add_subplot(rows,
    641649                                                cols, i+1)
    642                     if asaprcParams['plotter.xaxisformatting'] == 'mpl':
     650                    if asaprcParams['plotter.axesformatting'] != 'mpl':
    643651                        self.subplots[i]['axes'].xaxis.set_major_formatter(OldScalarFormatter())
    644652                else:
     
    646654                        self.subplots[i]['axes'] = self.figure.add_subplot(rows,
    647655                                                cols, i+1)
    648                         if asaprcParams['plotter.xaxisformatting'] != 'mpl':
     656                        if asaprcParams['plotter.axesformatting'] != 'mpl':
    649657                           
    650658                            self.subplots[i]['axes'].xaxis.set_major_formatter(OldScalarFormatter())
     
    730738
    731739            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
    736748            for sp in self.subplots:
    737749                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)/2
    742750                ax.title.set_size(tsize)
    743                 fp = FP(size=rcParams['axes.labelsize'])
    744751                setp(ax.get_xticklabels(), fontsize=xts)
    745752                setp(ax.get_yticklabels(), fontsize=yts)
    746                 origx =  fp.get_size_in_points()
    747                 origy = origx
    748753                off = 0
    749754                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)
    752756                off = 0
    753757                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)
    756759
    757760    def subplot(self, i=None, inc=None):
Note: See TracChangeset for help on using the changeset viewer.