Test whether the mouse event occurred in the collection. Returns T/F, dict(ind=itemlist), where every item in itemlist contains the event.
Reimplemented from matplotlib::artist::Artist.
00698 : """ Test whether the mouse event occurred in the collection. Returns T/F, dict(ind=itemlist), where every item in itemlist contains the event. """ import matplotlib.lines as ML if callable(self._contains): return self._contains(self,mouseevent) # TODO: add offset processing; adjusting the mouse for each offset # will be somewhat cheaper than adjusting the segments. if self._offsets != None: raise NotImplementedError, "LineCollection does not yet support picking with offsets" mx,my = mouseevent.x,mouseevent.y transform = self.get_transform() ind =  for this in xrange(len(self._segments)): xy = transform.seq_xy_tups(self._segments[this]) this_ind = ML.segment_hits(mx,my,xy[:,0],xy[:,1],self.pickradius) ind.extend([(this,k) for k in this_ind]) return len(ind)>0,dict(ind=ind) def set_pickradius(self,pickradius): self.pickradius = 5