- Timestamp:
- 07/23/12 18:28:01 (12 years ago)
- Location:
- trunk/python
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/customgui_base.py
r2605 r2606 877 877 self._thisregion['worldx'][1] = xdataend 878 878 lregion = self._thisregion['worldx'] 879 # WORKAROUND for the issue axvspan started to reset xlim. 880 axlimx = self._thisregion['axes'].get_xlim() 879 881 pregion = self._thisregion['axes'].axvspan(lregion[0],lregion[1], 880 882 facecolor='0.7') 883 self._thisregion['axes'].set_xlim(axlimx) 884 881 885 self.plotter._plotter.canvas.draw() 882 886 self._polygons.append(pregion) … … 959 963 ax = self.plotter._plotter.subplots[irow - int(strow)]['axes'] 960 964 mlist = regions.pop(str(irow)) 965 # WORKAROUND for the issue axvspan started to reset xlim. 966 axlimx = ax.get_xlim() 961 967 for i in range(len(mlist)): 962 968 self._polygons.append(ax.axvspan(mlist[i][0],mlist[i][1], 963 969 facecolor='0.7')) 964 del ax,mlist 970 ax.set_xlim(axlimx) 971 del ax,mlist,axlimx 965 972 if irow in panels: 966 973 ax = self.plotter._plotter.subplots[irow - int(strow)]['axes'] … … 1189 1196 return 1190 1197 # set row and panel counters to those of the 1st panel of previous page 1191 maxpanel = 161198 maxpanel = 25 1192 1199 # the ID of the last panel in current plot 1193 1200 lastpanel = self.plotter._ipanel … … 1232 1239 1233 1240 def _get_pagenum(self): 1234 maxpanel = 161241 maxpanel = 25 1235 1242 # get the ID of last panel in the current page 1236 1243 idlastpanel = self.plotter._ipanel -
trunk/python/flagplotter.py
r2605 r2606 32 32 self.set_stacking('scan') 33 33 self._ismodified = False 34 self._showflag = True #False34 self._showflagged = False 35 35 self.set_colors("blue gray",False) 36 36 … … 51 51 asaplog.post("ERROR") 52 52 53 def set_showflag (self, show):53 def set_showflagged(self, show): 54 54 """ Whether or not plotting flagged data""" 55 55 if type(show) == bool: 56 self._showflag = show 56 self._showflagged = show 57 print "self._showflagged =", str(show) 58 else: 59 raise TypeError, "Input parameter should be a bool." 57 60 58 61 @asaplog_post_dec … … 130 133 if self._is_new_scan(scan): 131 134 self._ismodified = False 132 if not self._showflag :135 if not self._showflagged: 133 136 self.set_legend(mode=None,refresh=False) 134 137 elif not self._legendloc: … … 139 142 @asaplog_post_dec 140 143 def _plot(self, scan): 141 self._plot_with_flag(scan,self._showflag) 144 self._plot_with_flag(scan,self._showflagged) 145 #asapplotter._plot(self,scan) 142 146 # rescale x-range of subplots 5% margins 143 147 ganged = (self._plotter.axes._sharex != None) … … 156 160 157 161 @asaplog_post_dec 158 def _plot_with_flag(self, scan, showflag= True):162 def _plot_with_flag(self, scan, showflag=False): 159 163 # total number of panles to plot as a whole 160 164 nptot = scan.nrow() … … 180 184 nr = scan.nrow() 181 185 panelcount = 0 182 186 allylim = [] 187 allxlim = [] 188 183 189 while r < nr: 184 190 # always plot to new panel … … 205 211 # Now get data to plot 206 212 y = scan._getspectrum(r) 207 # flag row213 # Check for FLAGROW column 208 214 mr = scan._getflagrow(r) 209 215 from numpy import ma, array … … 225 231 if self._offset: 226 232 x += self._offset 227 llbl = self._get_label(scan, r, mode='legend', userlabel=self._lmap) 228 if type(llbl) in (list, tuple): 229 llbl = llbl[0] 230 self._plotter.set_line(label=llbl) 231 plotit = self._plotter.plot 232 if self._hist: plotit = self._plotter.hist 233 plotit(x,ys) 233 #llbl = self._get_label(scan, r, mode='legend', userlabel=self._lmap) 234 #if type(llbl) in (list, tuple): 235 # llbl = llbl[0] 236 #self._plotter.set_line(label=llbl) 237 self._plotter.set_line(label="data") 238 #plotit = self._plotter.plot 239 #if self._hist: plotit = self._plotter.hist 240 self._plotter.plot(x,ys) 234 241 if showflag: 235 242 self._plotter.set_line(label="flagged") 236 plotit(x,yf) 243 self._plotter.plot(x,yf) 244 ylim = self._minmaxy or [min(y),max(y)] 245 xlim= self._minmaxx or [min(x),max(x)] 246 elif mr or ys.mask.all(): 247 ylim = self._minmaxy or [] 248 xlim = self._minmaxx or [] 249 else: 250 ylim = self._minmaxy or [ma.minimum(ys),ma.maximum(ys)] 251 xlim= self._minmaxx or [min(x),max(x)] 252 allylim += ylim 253 allxlim += xlim 237 254 if (panelcount == n) or (r == nr-1): 238 255 break 239 256 r+=1 # next row 240 257 258 # Set x- and y- limts of subplots 259 if ganged: 260 xlim = None 261 ylim = None 262 if len(allylim) > 0: 263 allylim.sort() 264 ylim = allylim[0],allylim[-1] 265 if len(allxlim) > 0: 266 allxlim.sort() 267 xlim = allxlim[0],allxlim[-1] 268 self._plotter.set_limits(xlim=xlim,ylim=ylim) 241 269 242 270 # save the current counter for multi-page plotting
Note:
See TracChangeset
for help on using the changeset viewer.