Title: scatter could not raise when colors are provided but position data are empty · Issue #14113 · matplotlib/matplotlib · GitHub
Open Graph Title: scatter could not raise when colors are provided but position data are empty · Issue #14113 · matplotlib/matplotlib
X Title: scatter could not raise when colors are provided but position data are empty · Issue #14113 · matplotlib/matplotlib
Description: The 3.0.x series added new checks in scatter for equivalence between the length of the x, y vectors and the length of the c vectors. These changes have broken code in seaborn that sometimes calls scatter with empty position data but non-...
Open Graph Description: The 3.0.x series added new checks in scatter for equivalence between the length of the x, y vectors and the length of the c vectors. These changes have broken code in seaborn that sometimes calls s...
X Description: The 3.0.x series added new checks in scatter for equivalence between the length of the x, y vectors and the length of the c vectors. These changes have broken code in seaborn that sometimes calls s...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/14113
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"scatter could not raise when colors are provided but position data are empty","articleBody":"The 3.0.x series added new checks in `scatter` for equivalence between the length of the `x`, `y` vectors and the length of the `c` vectors.\r\n\r\nThese changes have broken code in seaborn that sometimes calls scatter with empty position data but non-empty color data, e.g.\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\nf, ax = plt.subplots()\r\nax.scatter([], [], c=[\"r\", \"b\", \"g\"])\r\n```\r\n```python-traceback\r\n---------------------------------------------------------------------------\r\nValueError Traceback (most recent call last)\r\n~/anaconda/envs/seaborn-dev/lib/python3.6/site-packages/matplotlib/axes/_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs)\r\n 4237 valid_shape = False\r\n-\u003e 4238 raise ValueError\r\n 4239 except ValueError:\r\n\r\nValueError: \r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nValueError Traceback (most recent call last)\r\n\u003cipython-input-2-41dfae030a6e\u003e in \u003cmodule\u003e()\r\n 1 import matplotlib.pyplot as plt\r\n 2 f, ax = plt.subplots()\r\n----\u003e 3 ax.scatter([], [], c=[\"r\", \"b\", \"g\"])\r\n\r\n~/anaconda/envs/seaborn-dev/lib/python3.6/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)\r\n 1808 \"the Matplotlib list!)\" % (label_namer, func.__name__),\r\n 1809 RuntimeWarning, stacklevel=2)\r\n-\u003e 1810 return func(ax, *args, **kwargs)\r\n 1811 \r\n 1812 inner.__doc__ = _add_data_doc(inner.__doc__,\r\n\r\n~/anaconda/envs/seaborn-dev/lib/python3.6/site-packages/matplotlib/axes/_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs)\r\n 4243 \"acceptable for use with 'x' with size {xs}, \"\r\n 4244 \"'y' with size {ys}.\"\r\n-\u003e 4245 .format(nc=n_elem, xs=x.size, ys=y.size)\r\n 4246 )\r\n 4247 # Both the mapping *and* the RGBA conversion failed: pretty\r\n\r\nValueError: 'c' argument has 3 elements, which is not acceptable for use with 'x' with size 0, 'y' with size 0.\r\n```\r\n\r\nIMO this is an unnecessary exception because it conflicts with another patten in matplotlib, which is passing empty data along with specified style attributes (e.g. to create a proxy artist). I appreciate that the `c` parameter occupies a fuzzy zone between data and style attribute. But specifically in the case when the position data are *empty*, no points will have the wrong colors.","author":{"url":"https://github.com/mwaskom","@type":"Person","name":"mwaskom"},"datePublished":"2019-05-01T15:00:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":11},"url":"https://github.com/14113/matplotlib/issues/14113"}
| 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:daee9d66-1833-7b38-8ce2-05740f51e27e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B864:3F84A9:5B8507:7C8BDD:6A580809 |
| html-safe-nonce | 7d7df4a288ec2fa2fc5b36255ee1e3b32279376bc5548ad3c9294f592021198c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODY0OjNGODRBOTo1Qjg1MDc6N0M4QkREOjZBNTgwODA5IiwidmlzaXRvcl9pZCI6IjE2MDg4Nzg5NTgyNzEwMDY3MjkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 69abe148bf1c343a1fa44009b8e40da52306c6c92e4d77688b966c705d754ccd |
| hovercard-subject-tag | issue:439194899 |
| 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/14113/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ea9cf5316bfae9ba5f7a61171a849ca093d3aa595c43116636c2617d431a5d7e/matplotlib/matplotlib/issues/14113 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ea9cf5316bfae9ba5f7a61171a849ca093d3aa595c43116636c2617d431a5d7e/matplotlib/matplotlib/issues/14113 |
| og:image:alt | The 3.0.x series added new checks in scatter for equivalence between the length of the x, y vectors and the length of the c vectors. These changes have broken code in seaborn that sometimes calls s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mwaskom |
| hostname | github.com |
| expected-hostname | github.com |
| None | 49c8c15fabcbf356d607a90ca115c13b273e42ff8b74155de050fd229a9b0121 |
| 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 | 3fb1f684e7a833eb1b2d01d39875a2b52cb4fe9b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width