- Timestamp:
- 03/30/09 13:50:19 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapplotter.py
r1551 r1555 104 104 self._plotter.figure.show() 105 105 106 def create_mask(self, **kwargs): 107 nwindows = 1 108 panel = kwargs.get("panel", 0) 109 if kwargs.has_key("nwindows"): 110 nwindows = kwargs.pop("nwindows") 106 def create_mask(self, nwin=1, panel=0, color=None): 107 if self._data is None: 108 return [] 111 109 outmask = [] 112 110 self._plotter.subplot(panel) … … 116 114 self.refresh() 117 115 118 for w in xrange(nwindows): 116 def cleanup(lines=False, texts=False, refresh=False): 117 if lines: 118 del self._plotter.axes.lines[-1] 119 if texts: 120 del self._plotter.axes.texts[-1] 121 if refresh: 122 self.refresh() 123 124 for w in xrange(nwin): 119 125 wpos = [] 120 self.text(0.05,1.0, "Add start boundary", coords="relative", fontsize=10) 121 wpos.append(self._plotter.get_point()[0]) 122 del self._plotter.axes.texts[-1] 123 self.axvline(wpos[0], **kwargs) 126 self.text(0.05,1.0, "Add start boundary", 127 coords="relative", fontsize=10) 128 point = self._plotter.get_point() 129 cleanup(texts=True) 130 if point is None: 131 continue 132 wpos.append(point[0]) 133 self.axvline(wpos[0], color=color) 124 134 self.text(0.05,1.0, "Add end boundary", coords="relative", fontsize=10) 125 wpos.append(self._plotter.get_point()[0]) 126 del self._plotter.axes.lines[-1] 127 kwargs["alpha"] = 0.1 128 self.axvspan(wpos[0], wpos[1], **kwargs) 135 point = self._plotter.get_point() 136 cleanup(texts=True, lines=True) 137 if point is None: 138 self.refresh() 139 continue 140 wpos.append(point[0]) 141 self.axvspan(wpos[0], wpos[1], alpha=0.1, 142 edgecolor=color, facecolor=color) 143 ymin, ymax = self._plotter.axes.get_ylim() 129 144 outmask.append(wpos) 130 return self._data.create_mask(*outmask) 145 146 self._plotter.axes.set_xlim(xmin, xmax) 147 self.refresh() 148 if len(outmask) > 0: 149 return self._data.create_mask(*outmask) 150 return [] 131 151 132 152 # forwards to matplotlib axes
Note:
See TracChangeset
for help on using the changeset viewer.