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

Skip to content

Path fast verts bug fix #4008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
BUG : Add validation for masked arrays in _revalidate
Ensure that transforms that return masked arrays have the arrays
filled with nan

Improved the code readability.
  • Loading branch information
tacaswell committed Jan 18, 2015
commit c9244df82ec781894d6edfec33bdce8a89c15be1
27 changes: 19 additions & 8 deletions lib/matplotlib/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2615,14 +2615,25 @@ def __init__(self, path, transform):
self._transformed_points = None

def _revalidate(self):
# only recompute if the invalidation includes the non_affine part of the transform
if ((self._invalid & self.INVALID_NON_AFFINE == self.INVALID_NON_AFFINE)
or self._transformed_path is None):
self._transformed_path = \
self._transform.transform_path_non_affine(self._path)
self._transformed_points = \
Path._fast_from_codes_and_verts(self._transform.transform_non_affine(self._path.vertices),
None, {'interpolation_steps': self._path._interpolation_steps})
# only recompute if the invalidation includes
# the non_affine part of the transform
if ((self._invalid &
self.INVALID_NON_AFFINE == self.INVALID_NON_AFFINE)
or self._transformed_path is None):

tpath = self._transform.transform_path_non_affine(self._path)
self._transformed_path = tpath

x = self._transform.transform_non_affine(self._path.vertices)
if ma.isMaskedArray(x):
x = x.astype(np.float_).filled(np.nan)

tpts = Path._fast_from_codes_and_verts(verts=x, codes=None,
internals={'interpolation_steps':
self._path._interpolation_steps})

self._transformed_points = tpts

self._invalid = 0

def get_transformed_points_and_affine(self):
Expand Down