Title: Scatter3D: facecolor or color to "none" leads to an error · Issue #18020 · matplotlib/matplotlib · GitHub
Open Graph Title: Scatter3D: facecolor or color to "none" leads to an error · Issue #18020 · matplotlib/matplotlib
X Title: Scatter3D: facecolor or color to "none" leads to an error · Issue #18020 · matplotlib/matplotlib
Description: Assigning "none" to facecolor or color parameter does not work any longer for 3D scatter plots. My current version of matplotlib is 3.2.2 import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D np.rando...
Open Graph Description: Assigning "none" to facecolor or color parameter does not work any longer for 3D scatter plots. My current version of matplotlib is 3.2.2 import numpy as np import matplotlib.pyplot as plt from mpl...
X Description: Assigning "none" to facecolor or color parameter does not work any longer for 3D scatter plots. My current version of matplotlib is 3.2.2 import numpy as np import matplotlib.pyplot as pl...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/18020
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Scatter3D: facecolor or color to \"none\" leads to an error","articleBody":"Assigning \"none\" to facecolor or color parameter does not work any longer for 3D scatter plots. My current version of matplotlib is 3.2.2\r\n\r\n```python\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nfrom mpl_toolkits.mplot3d import Axes3D\r\n\r\nnp.random.seed(2121)\r\nx = np.random.randn(3, 10)\r\n\r\n# %% 2D (still working)\r\nfig = plt.figure()\r\nax = fig.add_subplot(111)\r\nax.scatter(*x[0:2, :], marker='o', facecolor='blue', color='red', s=50) # working\r\nfig = plt.figure()\r\nax = fig.add_subplot(111)\r\nax.scatter(*x[0:2, :], marker='o', facecolor='none', color='red', s=50) # working\r\nfig = plt.figure()\r\nax = fig.add_subplot(111)\r\nax.scatter(*x[0:2, :], marker='o', facecolor='blue', color='none', s=50) # working\r\n\r\n# %% 3D (not working any longer)\r\nfig = plt.figure()\r\nax = fig.add_subplot(111, projection='3d')\r\nax.scatter(*x, marker='o', facecolor='blue', color='red', s=50) # working\r\nfig = plt.figure()\r\nax = fig.add_subplot(111, projection='3d')\r\nax.scatter(*x, marker='o', facecolor=\"none\", color='red', s=50) # NOT working\r\nfig = plt.figure()\r\nax = fig.add_subplot(111, projection='3d')\r\nax.scatter(*x, marker='o', facecolor='blue', color=\"none\", s=50) # NOT working\r\n```\r\n\r\nThe console returns the following error:\r\n```\r\n\u003cmpl_toolkits.mplot3d.art3d.Path3DCollection at 0x7f668ea53b90\u003eTraceback (most recent call last):\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/matplotlib/backends/backend_qt5.py\", line 496, in _draw_idle\r\n self.draw()\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/matplotlib/backends/backend_agg.py\", line 393, in draw\r\n self.figure.draw(self.renderer)\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/matplotlib/artist.py\", line 38, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/matplotlib/figure.py\", line 1736, in draw\r\n renderer, self, artists, self.suppressComposite)\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/matplotlib/image.py\", line 137, in _draw_list_compositing_images\r\n a.draw(renderer)\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/matplotlib/artist.py\", line 38, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/mpl_toolkits/mplot3d/axes3d.py\", line 293, in draw\r\n reverse=True)):\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/mpl_toolkits/mplot3d/axes3d.py\", line 292, in \u003clambda\u003e\r\n key=lambda col: col.do_3d_projection(renderer),\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/mpl_toolkits/mplot3d/art3d.py\", line 540, in do_3d_projection\r\n fcs = (_zalpha(self._facecolor3d, vzs) if self._depthshade else\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/mpl_toolkits/mplot3d/art3d.py\", line 847, in _zalpha\r\n rgba = np.broadcast_to(mcolors.to_rgba_array(colors), (len(zs), 4))\r\n File \"\u003c__array_function__ internals\u003e\", line 6, in broadcast_to\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/numpy/lib/stride_tricks.py\", line 182, in broadcast_to\r\n return _broadcast_to(array, shape, subok=subok, readonly=True)\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/numpy/lib/stride_tricks.py\", line 127, in _broadcast_to\r\n op_flags=['readonly'], itershape=shape, order='C')\r\nValueError: operands could not be broadcast together with remapped shapes [original-\u003eremapped]: (0,4) and requested shape (10,4)\r\nTraceback (most recent call last):\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/matplotlib/backends/backend_qt5.py\", line 496, in _draw_idle\r\n self.draw()\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/matplotlib/backends/backend_agg.py\", line 393, in draw\r\n self.figure.draw(self.renderer)\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/matplotlib/artist.py\", line 38, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/matplotlib/figure.py\", line 1736, in draw\r\n renderer, self, artists, self.suppressComposite)\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/matplotlib/image.py\", line 137, in _draw_list_compositing_images\r\n a.draw(renderer)\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/matplotlib/artist.py\", line 38, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/mpl_toolkits/mplot3d/axes3d.py\", line 293, in draw\r\n reverse=True)):\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/mpl_toolkits/mplot3d/axes3d.py\", line 292, in \u003clambda\u003e\r\n key=lambda col: col.do_3d_projection(renderer),\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/mpl_toolkits/mplot3d/art3d.py\", line 540, in do_3d_projection\r\n fcs = (_zalpha(self._facecolor3d, vzs) if self._depthshade else\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/mpl_toolkits/mplot3d/art3d.py\", line 847, in _zalpha\r\n rgba = np.broadcast_to(mcolors.to_rgba_array(colors), (len(zs), 4))\r\n File \"\u003c__array_function__ internals\u003e\", line 6, in broadcast_to\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/numpy/lib/stride_tricks.py\", line 182, in broadcast_to\r\n return _broadcast_to(array, shape, subok=subok, readonly=True)\r\n File \"/home/vanwynch/anaconda3/lib/python3.7/site-packages/numpy/lib/stride_tricks.py\", line 127, in _broadcast_to\r\n op_flags=['readonly'], itershape=shape, order='C')\r\nValueError: operands could not be broadcast together with remapped shapes [original-\u003eremapped]: (0,4) and requested shape (10,4)\r\n```\r\n\r\nThe workaround is to use (0, 0, 0, 0) as color/facecolor rather than \"none\" :\r\n```python\r\n# %% 3D workaround\r\nfig = plt.figure()\r\nax = fig.add_subplot(111, projection='3d')\r\nax.scatter(*x, marker='o', facecolor='blue', color='red', s=50) # working\r\nfig = plt.figure()\r\nax = fig.add_subplot(111, projection='3d')\r\nax.scatter(*x, marker='o', facecolor=(0, 0, 0, 0), color='red', s=50) # working\r\nfig = plt.figure()\r\nax = fig.add_subplot(111, projection='3d')\r\nax.scatter(*x, marker='o', facecolor='blue', color=(0, 0, 0, 0), s=50) # working\r\n```","author":{"url":"https://github.com/cvanwynsberghe","@type":"Person","name":"cvanwynsberghe"},"datePublished":"2020-07-22T16:53:59.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/18020/matplotlib/issues/18020"}
| 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:15ef94a4-f8b1-50dd-b0a1-95d0ab5b8e25 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 81B8:D445D:12E2100:198D0D4:6A521784 |
| html-safe-nonce | a87f8510bdac4db7b1644112924ed443b16ca4d7d0ef694bc0bef19fcf5e6f96 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MUI4OkQ0NDVEOjEyRTIxMDA6MTk4RDBENDo2QTUyMTc4NCIsInZpc2l0b3JfaWQiOiI2NzYwNzU5Nzk4MjQ4MTE4MTQ4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b71153a053dfee4a0245aee148e799db47de1759712b32fa089b87cc20a93d57 |
| hovercard-subject-tag | issue:663908561 |
| 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/18020/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d3b2cc42900b23bd73189904f653f6dd8710404a200d308b9af13478a70bc5a5/matplotlib/matplotlib/issues/18020 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d3b2cc42900b23bd73189904f653f6dd8710404a200d308b9af13478a70bc5a5/matplotlib/matplotlib/issues/18020 |
| og:image:alt | Assigning "none" to facecolor or color parameter does not work any longer for 3D scatter plots. My current version of matplotlib is 3.2.2 import numpy as np import matplotlib.pyplot as plt from mpl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cvanwynsberghe |
| 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