Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 85ebe51

Browse files
committed
contains() was relying on some attributes being set by draw(). Add code to make contains() not cause a traceback if draw() has not been called.
svn path=/trunk/matplotlib/; revision=8730
1 parent ed2767c commit 85ebe51

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

lib/matplotlib/lines.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ def __init__(self, xdata, ydata,
248248
# chance to init axes (and hence unit support)
249249
self.update(kwargs)
250250
self.pickradius = pickradius
251+
self.ind_offset = 0
251252
if is_numlike(self._picker):
252253
self.pickradius = self._picker
253254

@@ -283,6 +284,8 @@ def contains(self, mouseevent):
283284
if len(self._xy)==0: return False,{}
284285

285286
# Convert points to pixels
287+
if self._transformed_path is None:
288+
self._transform_path()
286289
path, affine = self._transformed_path.get_transformed_path_and_affine()
287290
path = affine.transform_path(path)
288291
xy = path.vertices

0 commit comments

Comments
 (0)