Title: contour edge case with all data below levels and a surrounding field of zeros · Issue #20203 · matplotlib/matplotlib · GitHub
Open Graph Title: contour edge case with all data below levels and a surrounding field of zeros · Issue #20203 · matplotlib/matplotlib
X Title: contour edge case with all data below levels and a surrounding field of zeros · Issue #20203 · matplotlib/matplotlib
Description: Bug report Bug summary If I attempt to make a contour plot with data that is entirely below the lowest level, and the data has a field of zeros around it, I get an unexpected contour between the zeros and anything positive. Code for repr...
Open Graph Description: Bug report Bug summary If I attempt to make a contour plot with data that is entirely below the lowest level, and the data has a field of zeros around it, I get an unexpected contour between the ze...
X Description: Bug report Bug summary If I attempt to make a contour plot with data that is entirely below the lowest level, and the data has a field of zeros around it, I get an unexpected contour between the ze...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/20203
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"contour edge case with all data below levels and a surrounding field of zeros","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\n\u003c!--A short 1-2 sentences that succinctly describes the bug--\u003e\r\nIf I attempt to make a contour plot with data that is entirely below the lowest level, and the data has a field of zeros around it, I get an unexpected contour between the zeros and anything positive.\r\n\r\n**Code for reproduction**\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```python\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\n\r\ny = np.linspace(-10, 10, 20)\r\nx_2d, y_2d = np.meshgrid(y, y)\r\n\r\ndata = np.cos(x_2d * np.pi/10.) + np.cos(y_2d * np.pi/10.)\r\nnp.place(data, data \u003c 0., 0.)\r\n\r\nlevels = [3, 6]\r\ncolors = ['b', 'r']\r\n\r\nplt.contour(data, levels=levels, colors=colors)\r\n\r\nplt.show()\r\n```\r\n\r\n**Actual outcome**\r\n\r\n\u003c!--The output produced by the above code, which may be a screenshot, console output, etc.--\u003e\r\n\r\n\r\n**Expected outcome**\r\n\r\nThe plot should be blank, which is what happens if the call to `np.place` is skipped.\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\n**Matplotlib version**\r\n\u003c!--Please specify your platform and versions of the relevant libraries you are using:--\u003e\r\n * Operating system: RHEL7.9\r\n * Matplotlib version (`import matplotlib; print(matplotlib.__version__)`): 3.4.1\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): Qt5Agg\r\n * Python version: 3.8.8\r\n * Jupyter version (if applicable): N/A\r\n * Other libraries: numpy 1.20.2\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/rcomer","@type":"Person","name":"rcomer"},"datePublished":"2021-05-11T10:06:27.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/20203/matplotlib/issues/20203"}
| 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:6cf2413c-d57d-a302-c072-e2f35af12196 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E448:132037:21C565:3080D7:6A50F2F9 |
| html-safe-nonce | cda8ba4d506a270a6a3e4ad3821abea1f68b252a61b190f311abc030640e40eb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDQ4OjEzMjAzNzoyMUM1NjU6MzA4MEQ3OjZBNTBGMkY5IiwidmlzaXRvcl9pZCI6Ijg4NDc2OTk3MzYxMTI3MjI2ODEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6b4fd7d385373295ef6713ee7045c4eeee737dde90eca7eb75dc3de5886629b5 |
| hovercard-subject-tag | issue:886744663 |
| 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/20203/issue_layout |
| twitter:image | https://opengraph.githubassets.com/524fa99ce1916389c1351aebaa87b7dd9fc4bf72fe74ed18318433c0001949b8/matplotlib/matplotlib/issues/20203 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/524fa99ce1916389c1351aebaa87b7dd9fc4bf72fe74ed18318433c0001949b8/matplotlib/matplotlib/issues/20203 |
| og:image:alt | Bug report Bug summary If I attempt to make a contour plot with data that is entirely below the lowest level, and the data has a field of zeros around it, I get an unexpected contour between the ze... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rcomer |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5266e58c17a510c403505cc811606465e90a881d2007ee7df1c4800d5c659838 |
| 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 | 5ec60191a48933536a90c8a19f47142fcd0d4739 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width