-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Closed
Labels
Difficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issueshttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesGood first issueOpen a pull request against these issues if there are no active ones!Open a pull request against these issues if there are no active ones!status: confirmed bugtopic: path handling
Milestone
Description
Bug report
Bug summary
This bug does not seem to have surfaced anywhere yet, but Path's with NaN vertices at CLOSEPOLY can come through PathNanRemover in a "correct" state but then PathSimplifier can sometimes break it:
Code for reproduction/Actual Outcome
>>> p = Path([(0, 0), (1, 0), (1, 1), (np.nan, np.nan)],
[Path.MOVETO, Path.LINETO, Path.LINETO, Path.CLOSEPOLY])
>>> # correctly ignores CLOSEPOLY even though it's NaN
>>> p.cleaned(remove_nans=True)
Path(array([[ 0., 0.],
[ 1., 0.],
[ 1., 1.],
[nan, nan],
[ 0., 0.]]), array([ 1, 2, 2, 79, 0], dtype=uint8))
>>> # but now for some reason these NaN's are used to populate LINETO's
>>> p.cleaned(remove_nans=True, simplify=True)
Path(array([[ 0., 0.],
[ 1., 0.],
[ 1., 1.],
[nan, nan],
[nan, nan],
[ 0., 0.]]), array([1, 2, 2, 2, 2, 0], dtype=uint8))Expected outcome
The values of the vertices in a CLOSEPOLY should always be ignored, in favor of the most recent MOVETO's vertex values:
>>> p.cleaned(remove_nans=True, simplify=True)
Path(array([[ 0., 0.],
[ 1., 0.],
[ 1., 1.],
[0, 0],
[ 0., 0.]]), array([1, 2, 2, 2, 0], dtype=uint8))Matplotlib version
- Operating system:
- Matplotlib version:
- Matplotlib backend (
print(matplotlib.get_backend())): - Python version:
- Jupyter version (if applicable):
- Other libraries:
Metadata
Metadata
Assignees
Labels
Difficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issueshttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesGood first issueOpen a pull request against these issues if there are no active ones!Open a pull request against these issues if there are no active ones!status: confirmed bugtopic: path handling