Changeset 1023 for trunk/python


Ignore:
Timestamp:
04/19/06 11:43:15 (19 years ago)
Author:
mar637
Message:

The previous histogram plot was mutually exclusive with linestyle, so I am using asapplotbase.hist intead.

Location:
trunk/python
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asaplotbase.py

    r1020 r1023  
    139139
    140140
    141     def hist(self, x=None, y=None, fmt=None):
     141    def hist(self, x=None, y=None, msk=None, fmt=None, add=None):
    142142        """
    143143        Plot a histogram.  N.B. the x values refer to the start of the
     
    149149        if x is None:
    150150            if y is None: return
    151             x = range(0,len(y))
     151            x = range(len(y))
    152152
    153153        if len(x) != len(y):
    154154            return
    155 
    156155        l2 = 2*len(x)
    157         x2 = range(0,l2)
    158         y2 = range(0,l2)
    159 
    160         for i in range(0,l2):
     156        x2 = range(l2)
     157        y2 = range(l2)
     158        m2 = range(l2)
     159
     160        for i in range(l2):
    161161            x2[i] = x[i/2]
    162 
    163         y2[0] = 0
     162            m2[i] = msk[i/2]
     163
     164        y2[0] = 0.0
    164165        for i in range(1,l2):
    165166            y2[i] = y[(i-1)/2]
    166167
    167         self.plot(x2, y2, fmt)
     168        self.plot(x2, y2, m2, fmt, add)
    168169
    169170
  • trunk/python/asapplotter.py

    r1021 r1023  
    3737        self._maskselection = None
    3838        self._selection = selector()
    39         self._hist = None
    40         if rcParams['plotter.histogram']: self._hist = "steps"
    41         else: self._hist = "-"
    42        
     39        self._hist = rcParams['plotter.histogram']
     40
    4341    def _translate(self, instr):
    4442        keys = "s b i p t".split()
     
    272270                         plotter.histogram
    273271        """
    274         if hist: self._hist = "steps"
    275         else: self._hist = "-"
    276         if self._data: self.plot(self._data)
    277            
     272        self._hist = hist
     273        if self._data: self.plot(self._data)
     274
    278275    def set_linestyles(self, linestyles):
    279276        """
     
    478475                        llbl = self._get_label(scan, r, self._stacking, None)
    479476                self._plotter.set_line(label=llbl)
    480                 self._plotter.set_line(linestyle=self._hist)
    481                 self._plotter.plot(x,y,m)
     477                plotit = self._plotter.plot
     478                if self._hist: plotit = self._plotter.hist
     479                plotit(x,y,m)
    482480                xlim= self._minmaxx or [min(x),max(x)]
    483481                allxlim += xlim
Note: See TracChangeset for help on using the changeset viewer.