Title: BUG: matplotlib 3.4.0 -- Scatter with colormap and legend gives TypeError: object of type 'NoneType' has no len() · Issue #19779 · matplotlib/matplotlib · GitHub
Open Graph Title: BUG: matplotlib 3.4.0 -- Scatter with colormap and legend gives TypeError: object of type 'NoneType' has no len() · Issue #19779 · matplotlib/matplotlib
X Title: BUG: matplotlib 3.4.0 -- Scatter with colormap and legend gives TypeError: object of type 'NoneType' has no len() · Issue #19779 · matplotlib/matplotlib
Description: Bug report Bug summary With matplotlib 3.4.0, scatter plot with colormap and legend gives TypeError: object of type 'NoneType' has no len(). Code for reproduction import matplotlib.pyplot as plt y = [1, 2, 3, 4, 5] plt.scatter(y, y, labe...
Open Graph Description: Bug report Bug summary With matplotlib 3.4.0, scatter plot with colormap and legend gives TypeError: object of type 'NoneType' has no len(). Code for reproduction import matplotlib.pyplot as plt y ...
X Description: Bug report Bug summary With matplotlib 3.4.0, scatter plot with colormap and legend gives TypeError: object of type 'NoneType' has no len(). Code for reproduction import matplotlib.pyplot a...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/19779
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"BUG: matplotlib 3.4.0 -- Scatter with colormap and legend gives TypeError: object of type 'NoneType' has no len()","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\nWith `matplotlib` 3.4.0, scatter plot with colormap and legend gives `TypeError: object of type 'NoneType' has no len()`.\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 matplotlib.pyplot as plt\r\ny = [1, 2, 3, 4, 5]\r\nplt.scatter(y, y, label='Y', lw=0, s=8, c=y, cmap='viridis')\r\nplt.legend()\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\nTraceback (most recent call last):\r\n File \".../matplotlib/backends/backend_qt5.py\", line 475, in _draw_idle\r\n self.draw()\r\n File \".../matplotlib/backends/backend_agg.py\", line 406, in draw\r\n self.figure.draw(self.renderer)\r\n File \".../matplotlib/artist.py\", line 74, in draw_wrapper\r\n result = draw(artist, renderer, *args, **kwargs)\r\n File \".../matplotlib/artist.py\", line 51, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \".../matplotlib/figure.py\", line 2734, in draw\r\n mimage._draw_list_compositing_images(\r\n File \".../matplotlib/image.py\", line 132, in _draw_list_compositing_images\r\n a.draw(renderer)\r\n File \".../matplotlib/artist.py\", line 51, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \".../matplotlib/_api/deprecation.py\", line 431, in wrapper\r\n return func(*inner_args, **inner_kwargs)\r\n File \".../matplotlib/axes/_base.py\", line 2925, in draw\r\n mimage._draw_list_compositing_images(renderer, self, artists)\r\n File \".../matplotlib/image.py\", line 132, in _draw_list_compositing_images\r\n a.draw(renderer)\r\n File \".../matplotlib/artist.py\", line 51, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \".../matplotlib/legend.py\", line 614, in draw\r\n self._legend_box.draw(renderer)\r\n File \".../matplotlib/offsetbox.py\", line 368, in draw\r\n c.draw(renderer)\r\n File \".../matplotlib/offsetbox.py\", line 368, in draw\r\n c.draw(renderer)\r\n File \".../matplotlib/offsetbox.py\", line 368, in draw\r\n c.draw(renderer)\r\n [Previous line repeated 1 more time]\r\n File \".../matplotlib/offsetbox.py\", line 694, in draw\r\n c.draw(renderer)\r\n File \".../matplotlib/artist.py\", line 51, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \".../matplotlib/collections.py\", line 1009, in draw\r\n super().draw(renderer)\r\n File \".../matplotlib/artist.py\", line 51, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \".../matplotlib/collections.py\", line 380, in draw\r\n len(facecolors) == 1 and len(edgecolors) == 1 and\r\nTypeError: object of type 'NoneType' has no len()\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\nWith matplotlib 3.3.4, I get this (no warning or error):\r\n\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: Red Hat Enterprise Linux Server release 7.9 (Maipo)\r\n * Matplotlib version (`import matplotlib; print(matplotlib.__version__)`): 3.4.0\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): Qt5Agg\r\n * Python version: 3.8.3\r\n * Jupyter version (if applicable): N/A\r\n * Other libraries: Not sure what else you need, just let me know.\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/pllim","@type":"Person","name":"pllim"},"datePublished":"2021-03-26T18:19:04.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/19779/matplotlib/issues/19779"}
| 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:064a1717-ebab-4482-91df-37a58207004f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9D2E:24C5C6:146132A:1B100A4:6A51B6D1 |
| html-safe-nonce | a4356f653e414389af14ff5ab0d7afbc8686d88a8dbfe2d71982635e89829e4b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDJFOjI0QzVDNjoxNDYxMzJBOjFCMTAwQTQ6NkE1MUI2RDEiLCJ2aXNpdG9yX2lkIjoiNDI1NzU4OTk0MTE2MzM3NDI4OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 170b0137d400a4923b607165a2aa05e1823ddcf45136cb2685434e9ef89f0618 |
| hovercard-subject-tag | issue:842200609 |
| 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/19779/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9f630dd2ea30478d8c5a7ddad0905393e090fa70fac46dadc2995db1bb8f22b1/matplotlib/matplotlib/issues/19779 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9f630dd2ea30478d8c5a7ddad0905393e090fa70fac46dadc2995db1bb8f22b1/matplotlib/matplotlib/issues/19779 |
| og:image:alt | Bug report Bug summary With matplotlib 3.4.0, scatter plot with colormap and legend gives TypeError: object of type 'NoneType' has no len(). Code for reproduction import matplotlib.pyplot as plt y ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pllim |
| 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 | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width