Skip to content

Added the "cleared" method to Path, and updated the path module's documentation. #2011

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

Merged
merged 2 commits into from
May 21, 2013
Merged
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
Made the Path created by cleared consistent with the actions that hav…
…e taken place.
  • Loading branch information
pelson committed May 21, 2013
commit 855d343ba91fbeedbbb34f00dae75fdff62a04f8
21 changes: 13 additions & 8 deletions lib/matplotlib/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,26 +165,27 @@ def _fast_from_codes_and_verts(cls, verts, codes, internals=None):
"""
Creates a Path instance without the expense of calling the constructor

Use this method at your own risk...

Parameters
----------
verts : numpy array
codes : numpy array (may not be None)
internals : dict or None
The attributes that the resulting path should have.
Allowed keys are ``readonly``, ``should_simplify``,
``simplify_threshold``, ``has_nonfinite`` and
``interpolation_steps``.

"""
internals = internals or {}
pth = cls.__new__(cls)
pth._vertices = verts
pth._codes = codes
pth._readonly = internals.pop('_readonly', False)
pth._should_simplify = internals.pop('_should_simplify', True)
pth._simplify_threshold = internals.pop('_simplify_threshold',
pth._readonly = internals.pop('readonly', False)
pth.should_simplify = internals.pop('should_simplify', True)
pth.simplify_threshold = internals.pop('simplify_threshold',
rcParams['path.simplify_threshold'])
pth._has_nonfinite = internals.pop('_has_nonfinite', False)
pth._interpolation_steps = internals.pop('_interpolation_steps', 1)
pth._has_nonfinite = internals.pop('has_nonfinite', False)
pth._interpolation_steps = internals.pop('interpolation_steps', 1)
if internals:
raise ValueError('Unexpected internals provided to '
'_fast_from_codes_and_verts: '
Expand Down Expand Up @@ -436,7 +437,11 @@ def cleaned(self, transform=None, remove_nans=False, clip=None,
remove_nans, clip,
snap, stroke_width,
simplify, curves, sketch)
return Path._fast_from_codes_and_verts(vertices, codes)
internals = {'should_simplify': self.should_simplify and not simplify,
'has_nonfinite': self.has_nonfinite and not remove_nans,
'simplify_threshold': self.simplify_threshold,
'interpolation_steps': self._interpolation_steps}
return Path._fast_from_codes_and_verts(vertices, codes, internals)

def transformed(self, transform):
"""
Expand Down