Changeset 2700 for trunk/python/asapplotter.py
- Timestamp:
- 12/17/12 19:38:05 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapplotter.py
r2699 r2700 655 655 return 656 656 657 def set_histogram(self, hist=True, linewidth=None, refresh=True): 658 """ 659 Enable/Disable histogram-like plotting. 660 Parameters: 661 hist: True (default) or False. The fisrt default 662 is taken from the .asaprc setting 663 plotter.histogram 664 linewidth: a line width 665 refresh: True (default) or False. If True, the plot is 666 replotted based on the new parameter setting(s). 667 Otherwise,the parameter(s) are set without replotting. 668 """ 669 self._hist = hist 670 if isinstance(linewidth, float) or isinstance(linewidth, int): 671 from matplotlib import rc as rcp 672 rcp('lines', linewidth=linewidth) 673 if refresh and self._data: self.plot(self._data) 674 657 675 def set_colors(self, colmap, refresh=True): 658 676 """ … … 678 696 # alias for english speakers 679 697 set_colours = set_colors 680 681 def set_histogram(self, hist=True, linewidth=None, refresh=True):682 """683 Enable/Disable histogram-like plotting.684 Parameters:685 hist: True (default) or False. The fisrt default686 is taken from the .asaprc setting687 plotter.histogram688 linewidth: a line width689 refresh: True (default) or False. If True, the plot is690 replotted based on the new parameter setting(s).691 Otherwise,the parameter(s) are set without replotting.692 """693 self._hist = hist694 if isinstance(linewidth, float) or isinstance(linewidth, int):695 from matplotlib import rc as rcp696 rcp('lines', linewidth=linewidth)697 if refresh and self._data: self.plot(self._data)698 698 699 699 def set_linestyles(self, linestyles=None, linewidth=None, refresh=True): … … 921 921 self._maskselection = None 922 922 if refresh: self.plot(self._data) 923 924 def _slice_indeces(self, data):925 mn = self._minmaxx[0]926 mx = self._minmaxx[1]927 asc = data[0] < data[-1]928 start=0929 end = len(data)-1930 inc = 1931 if not asc:932 start = len(data)-1933 end = 0934 inc = -1935 # find min index936 #while start > 0 and data[start] < mn:937 # start+= inc938 minind=start939 for ind in xrange(start,end+inc,inc):940 if data[ind] > mn: break941 minind=ind942 # find max index943 #while end > 0 and data[end] > mx:944 # end-=inc945 #if end > 0: end +=1946 maxind=end947 for ind in xrange(end,start-inc,-inc):948 if data[ind] < mx: break949 maxind=ind950 start=minind951 end=maxind952 if start > end:953 return end,start+1954 elif start < end:955 return start,end+1956 else:957 return start,end958 923 959 924 … … 1300 1265 return userlabel or d[mode] 1301 1266 1267 def _slice_indeces(self, data): 1268 mn = self._minmaxx[0] 1269 mx = self._minmaxx[1] 1270 asc = data[0] < data[-1] 1271 start=0 1272 end = len(data)-1 1273 inc = 1 1274 if not asc: 1275 start = len(data)-1 1276 end = 0 1277 inc = -1 1278 # find min index 1279 #while start > 0 and data[start] < mn: 1280 # start+= inc 1281 minind=start 1282 for ind in xrange(start,end+inc,inc): 1283 if data[ind] > mn: break 1284 minind=ind 1285 # find max index 1286 #while end > 0 and data[end] > mx: 1287 # end-=inc 1288 #if end > 0: end +=1 1289 maxind=end 1290 for ind in xrange(end,start-inc,-inc): 1291 if data[ind] < mx: break 1292 maxind=ind 1293 start=minind 1294 end=maxind 1295 if start > end: 1296 return end,start+1 1297 elif start < end: 1298 return start,end+1 1299 else: 1300 return start,end 1301 1302 1302 def plotazel(self, scan=None, outfile=None): 1303 1303 """
Note: See TracChangeset
for help on using the changeset viewer.