Ignore:
Timestamp:
08/21/06 10:48:45 (18 years ago)
Author:
mar637
Message:

lots of changes to support soft refresh, for things like text overlays, linecatlogs etc. reworked plot_lines to to auto-peak detection. added forwarding functions to matplotlib.axes. drawing functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asaplotbase.py

    r1147 r1153  
    454454        if what[-6:] == 'colour': what = what[:-6] + 'color'
    455455
    456         newargs = {}
    457 
    458         for k, v in kwargs.iteritems():
    459             k = k.lower()
    460             if k == 'colour': k = 'color'
    461             newargs[k] = v
    462 
    463         getattr(self.axes, "set_%s"%what)(*args, **newargs)
    464 
    465         self.show()
     456        key = "colour"
     457        if kwargs.has_key(key):
     458            val = kwargs.pop(key)
     459            kwargs["color"] = val
     460
     461        getattr(self.axes, "set_%s"%what)(*args, **kwargs)
     462
     463        self.show(hardrefresh=False)
    466464
    467465
     
    485483
    486484        getattr(self.figure, "set_%s"%what)(*args, **newargs)
    487         self.show()
     485        self.show(hardrefresh=False)
    488486
    489487
     
    552550                    self.attributes[k] = v
    553551
    554         if redraw: self.show()
     552        if redraw: self.show(hardrefresh=False)
    555553
    556554
     
    613611            for i in range(nplots):
    614612                self.subplots.append({})
    615                 self.subplots[i]['axes'] = self.figure.add_subplot(rows,
     613                self.subplots[i]['lines'] = []
     614                if not ganged:
     615                    self.subplots[i]['axes'] = self.figure.add_subplot(rows,
    616616                                                cols, i+1)
    617                 self.subplots[i]['lines'] = []
    618 
    619                 if ganged:
     617                else:
     618                    if i == 0:
     619                        self.subplots[i]['axes'] = self.figure.add_subplot(rows,
     620                                                cols, i+1)
     621                    else:
     622                        self.subplots[i]['axes'] = self.figure.add_subplot(rows,
     623                                                cols, i+1,
     624                                                sharex=self.subplots[0]['axes'],
     625                                                sharey=self.subplots[0]['axes'])
    620626                    # Suppress tick labelling for interior subplots.
    621627                    if i <= (rows-1)*cols - 1:
     
    623629                            # Suppress x-labels for frames width
    624630                            # adjacent frames
    625                             self.subplots[i]['axes'].xaxis.set_major_locator(NullLocator())
     631                            for tick in self.subplots[i]['axes'].xaxis.majorTicks:
     632                                tick.label1On = False
    626633                            self.subplots[i]['axes'].xaxis.label.set_visible(False)
    627634                    if i%cols:
     
    631638                        self.subplots[i]['axes'].yaxis.label.set_visible(False)
    632639                    # disable the first tick of [1:ncol-1] of the last row
    633                     if (nplots-cols) < i <= nplots-1:
    634                         self.subplots[i]['axes'].xaxis.set_major_formatter(MyFormatter())
     640                    #if i+1 < nplots:
     641                    #    self.subplots[i]['axes'].xaxis.majorTicks[0].label1On = False
    635642                self.rows = rows
    636643                self.cols = cols
    637644            self.subplot(0)
    638645
     646    def tidy(self):
     647        # this needs to be exceuted after the first "refresh"
     648        nplots = len(self.subplots)
     649        if nplots == 1: return
     650        for i in xrange(nplots):
     651            ax = self.subplots[i]['axes']
     652            if i%self.cols:
     653                ax.xaxis.majorTicks[0].label1On = False
     654            else:
     655                if i != 0:
     656                    ax.yaxis.majorTicks[-1].label1On = False
     657
     658
    639659    def set_title(self, title=None):
    640660        """
     
    648668
    649669
    650     def show(self):
     670    def show(self, hardrefresh=True):
    651671        """
    652672        Show graphics dependent on the current buffering state.
    653673        """
     674        if not hardrefresh: return
    654675        if not self.buffering:
    655676            if self.loc is not None:
Note: See TracChangeset for help on using the changeset viewer.