Title: `PathSimplifier` fails to ignore `CLOSEPOLY` vertices · Issue #17914 · matplotlib/matplotlib · GitHub
Open Graph Title: `PathSimplifier` fails to ignore `CLOSEPOLY` vertices · Issue #17914 · matplotlib/matplotlib
X Title: `PathSimplifier` fails to ignore `CLOSEPOLY` vertices · Issue #17914 · matplotlib/matplotlib
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 reproduc...
Open Graph 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 c...
X 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 Pa...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/17914
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`PathSimplifier` fails to ignore `CLOSEPOLY` vertices","articleBody":"\u003c!--To help us understand and resolve your issue, please fill out the form to the best of your ability.--\u003e\r\n\u003c!--You can feel free to delete the sections that do not apply.--\u003e\r\n\r\n### Bug report\r\n\r\n**Bug summary**\r\n\r\nThis 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:\r\n\r\n**Code for reproduction**/**Actual Outcome**\r\n\r\n\u003c!--A minimum code snippet required to reproduce the bug.\r\nPlease make sure to minimize the number of dependencies required, and provide\r\nany necessary plotted data.\r\nAvoid using threads, as Matplotlib is (explicitly) not thread-safe.--\u003e\r\n\r\n\r\n```python\r\n\u003e\u003e\u003e p = Path([(0, 0), (1, 0), (1, 1), (np.nan, np.nan)],\r\n [Path.MOVETO, Path.LINETO, Path.LINETO, Path.CLOSEPOLY])\r\n\u003e\u003e\u003e # correctly ignores CLOSEPOLY even though it's NaN\r\n\u003e\u003e\u003e p.cleaned(remove_nans=True)\r\nPath(array([[ 0., 0.],\r\n [ 1., 0.],\r\n [ 1., 1.],\r\n [nan, nan],\r\n [ 0., 0.]]), array([ 1, 2, 2, 79, 0], dtype=uint8))\r\n\u003e\u003e\u003e # but now for some reason these NaN's are used to populate LINETO's\r\n\u003e\u003e\u003e p.cleaned(remove_nans=True, simplify=True)\r\nPath(array([[ 0., 0.],\r\n [ 1., 0.],\r\n [ 1., 1.],\r\n [nan, nan],\r\n [nan, nan],\r\n [ 0., 0.]]), array([1, 2, 2, 2, 2, 0], dtype=uint8))\r\n```\r\n\r\n**Expected outcome**\r\n\r\n\u003c!--A description of the expected outcome from the code snippet--\u003e\r\n\u003c!--If this used to work in an earlier version of Matplotlib, please note the version it used to work on--\u003e\r\n\r\nThe values of the vertices in a `CLOSEPOLY` should always be ignored, in favor of the most recent `MOVETO`'s vertex values:\r\n\r\n```python\r\n\u003e\u003e\u003e p.cleaned(remove_nans=True, simplify=True)\r\nPath(array([[ 0., 0.],\r\n [ 1., 0.],\r\n [ 1., 1.],\r\n [0, 0],\r\n [ 0., 0.]]), array([1, 2, 2, 2, 0], dtype=uint8))\r\n```\r\n\r\n**Matplotlib version**\r\n\u003c!--Please specify your platform and versions of the relevant libraries you are using:--\u003e\r\n * Operating system:\r\n * Matplotlib version: \r\n * Matplotlib backend (`print(matplotlib.get_backend())`):\r\n * Python version:\r\n * Jupyter version (if applicable):\r\n * Other libraries: \r\n\r\n\u003c!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--\u003e\r\n\u003c!--If you installed from conda, please specify which channel you used if not the default--\u003e\r\n\r\n","author":{"url":"https://github.com/brunobeltran","@type":"Person","name":"brunobeltran"},"datePublished":"2020-07-13T20:02:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/17914/matplotlib/issues/17914"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4b733f70-5922-c7e3-ba0a-3aff1f1746a6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D1C4:1826AA:61069E:816CB0:6A518A5C |
| html-safe-nonce | 64aa8f2bb7d8f75b5f2fbb5c790017d27b4bb45c6a46768bd3eb2e9a44ee8f6f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMUM0OjE4MjZBQTo2MTA2OUU6ODE2Q0IwOjZBNTE4QTVDIiwidmlzaXRvcl9pZCI6Ijg4Mjc5NzQwMDM1ODkyMjA5NTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d51d174d4cd08ba91aa40fb6cb885aff0a615688e17af6a67080c9a9d7b078ad |
| hovercard-subject-tag | issue:656102871 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/17914/issue_layout |
| twitter:image | https://opengraph.githubassets.com/29c0164db2cf3b2c50dc54602db3ee2e8aa2028bb8b9e3340f6e5f59f9991b31/matplotlib/matplotlib/issues/17914 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/29c0164db2cf3b2c50dc54602db3ee2e8aa2028bb8b9e3340f6e5f59f9991b31/matplotlib/matplotlib/issues/17914 |
| og:image:alt | 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 c... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | brunobeltran |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width