Changeset 1146 for trunk/python
- Timestamp:
- 08/16/06 11:35:42 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapplotter.py
r1116 r1146 1 1 from asap import rcParams, print_log, selector 2 from numarray import logical_and2 from asap import NUM 3 3 4 4 class asapplotter: … … 16 16 self._visible = visible 17 17 self._plotter = self._newplotter() 18 19 18 20 19 self._panelling = None … … 38 37 self._selection = selector() 39 38 self._hist = rcParams['plotter.histogram'] 40 from matplotlib import rc as mplrc41 mplrc('legend',fontsize=8)42 39 43 40 def _translate(self, instr): … … 359 356 rcp('font', size=size) 360 357 if self._data: self.plot(self._data) 358 359 def plot_lines(self, linecat=None, offset=0.0, peak=5.0, rotate=0.0, 360 location=None): 361 """ 362 """ 363 if not self._data: return 364 from asap._asap import linecatalog 365 if not isinstance(linecat, linecatalog): return 366 if not self._data.get_unit().endswith("GHz"): return 367 self._plotter.hold() 368 for j in range(len(self._plotter.subplots)): 369 self._plotter.subplot(j) 370 lims = self._plotter.axes.get_xlim() 371 for i in range(linecat.nrow()): 372 freq = linecat.get_frequency(i)/1000.0 + offset 373 if lims[0] < freq < lims[1]: 374 if location is None: 375 loc = 'bottom' 376 if i%2: loc='top' 377 else: loc = location 378 self._plotter.vline_with_label(freq, peak, linecat.get_name(i), 379 location=loc, rotate=rotate) 380 self._plotter.release() 361 381 362 382 def save(self, filename=None, orientation=None, dpi=None): … … 515 535 y = scan._getspectrum(r) 516 536 m = scan._getmask(r) 537 from matplotlib.numerix import logical_not, logical_and 517 538 if self._maskselection and len(self._usermask) == len(m): 518 539 if d[self._stacking](r) in self._maskselection[self._stacking]: 519 540 m = logical_and(m, self._usermask) 520 541 x = scan._getabcissa(r) 521 from matplotlib.numerix import ma, logical_not,array542 from matplotlib.numerix import ma, array 522 543 y = ma.masked_array(y,mask=logical_not(array(m,copy=False))) 523 544 if self._minmaxx is not None: … … 540 561 plotit = self._plotter.plot 541 562 if self._hist: plotit = self._plotter.hist 542 if len(x) > 0: plotit(x,y) 543 xlim= self._minmaxx or [min(x),max(x)] 544 allxlim += xlim 545 ylim= self._minmaxy or [ma.minimum(y),ma.maximum(y)] 546 allylim += ylim 563 if len(x) > 0: 564 plotit(x,y) 565 xlim= self._minmaxx or [min(x),max(x)] 566 allxlim += xlim 567 ylim= self._minmaxy or [ma.minimum(y),ma.maximum(y)] 568 allylim += ylim 547 569 stackcount += 1 548 570 # last in colour stack -> autoscale x
Note:
See TracChangeset
for help on using the changeset viewer.