Title: Cannot plot fully masked array against datetimes · Issue #11337 · matplotlib/matplotlib · GitHub
Open Graph Title: Cannot plot fully masked array against datetimes · Issue #11337 · matplotlib/matplotlib
X Title: Cannot plot fully masked array against datetimes · Issue #11337 · matplotlib/matplotlib
Description: Bug report Bug summary Cannot plot a fully masked array agaisnt an array of datetimes. A ValueError is raised for a seemingly unrelated reason. Surprisingly, matplotlib has no problem plotting a fully masked array by itself. Code for rep...
Open Graph Description: Bug report Bug summary Cannot plot a fully masked array agaisnt an array of datetimes. A ValueError is raised for a seemingly unrelated reason. Surprisingly, matplotlib has no problem plotting a fu...
X Description: Bug report Bug summary Cannot plot a fully masked array agaisnt an array of datetimes. A ValueError is raised for a seemingly unrelated reason. Surprisingly, matplotlib has no problem plotting a fu...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/11337
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cannot plot fully masked array against datetimes","articleBody":"### Bug report\r\n\r\n**Bug summary**\r\nCannot plot a fully masked array agaisnt an array of datetimes. A ValueError is raised for a seemingly unrelated reason. Surprisingly, matplotlib has no problem plotting a fully masked array by itself.\r\n\u003c!--A short 1-2 sentences that succinctly describes the bug--\u003e\r\n\r\n**Code for reproduction**\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\nfrom datetime import datetime\r\nimport numpy as np\r\n\r\nx = np.array([\r\n datetime(2017, 1, 1), \r\n datetime(2017, 1, 2), \r\n datetime(2017, 1, 3),\r\n datetime(2017, 1, 4),\r\n datetime(2017, 1, 5)\r\n])\r\n\r\ny = np.array([1,2,3,4,5])\r\nm = np.ma.masked_greater(y, 0)\r\n\r\nfig = plt.figure()\r\nax = fig.add_subplot(111)\r\nax.plot(x, m)\r\nplt.show()\r\n```\r\n\r\n**Actual outcome**\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[super big traceback, only showing the most recent to save space...]\r\n/usr/lib64/python3.5/dist-packages/matplotlib/dates.py in _from_ordinalf(x, tz)\r\n 258 \r\n 259 ix = int(x)\r\n--\u003e 260 dt = datetime.datetime.fromordinal(ix).replace(tzinfo=UTC)\r\n 261 \r\n 262 remainder = float(x) - ix\r\nValueError: ordinal must be \u003e= 1\r\n```\r\n\r\n**Expected outcome**\r\nAn empty graph. If you comment out `x` and don't plot against it, then matplotlib has no problem displaying an empty graph. It is only when you plot against a datetime array this is an issue.\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: GNU/Linux\r\n * Matplotlib version: 2.1.1\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): module://ipykernel.pylab.backend_inline\r\n * Python version: 3.5.5\r\n * Jupyter version (if applicable): 4.3.0\r\n * Other libraries: numpy, datetime\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/logdog","@type":"Person","name":"logdog"},"datePublished":"2018-05-29T19:05:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":13},"url":"https://github.com/11337/matplotlib/issues/11337"}
| 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:8dd52734-6c82-9d11-9b75-b60104ec528c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A52C:10FEF0:1A897A0:234C9AF:6A52C4A2 |
| html-safe-nonce | dd016b77af0b5c95cc9cd60e95e3744ceb1fcaeb35cd7eb235e8ace3e9f2944e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNTJDOjEwRkVGMDoxQTg5N0EwOjIzNEM5QUY6NkE1MkM0QTIiLCJ2aXNpdG9yX2lkIjoiMTQ3MTk1NDE1MTAzODY5ODY1OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3121bbddf51408a473cdb0165c7cf58e61eea599b583b1f3a2d5d2129ec8abf2 |
| hovercard-subject-tag | issue:327448733 |
| 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/11337/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4e3d762134246ee0139eeb7a0644c0f52402300ba405524c7d0298fd8f0ed978/matplotlib/matplotlib/issues/11337 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4e3d762134246ee0139eeb7a0644c0f52402300ba405524c7d0298fd8f0ed978/matplotlib/matplotlib/issues/11337 |
| og:image:alt | Bug report Bug summary Cannot plot a fully masked array agaisnt an array of datetimes. A ValueError is raised for a seemingly unrelated reason. Surprisingly, matplotlib has no problem plotting a fu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | logdog |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width