Title: Wrong Error Message · Issue #11919 · matplotlib/matplotlib · GitHub
Open Graph Title: Wrong Error Message · Issue #11919 · matplotlib/matplotlib
X Title: Wrong Error Message · Issue #11919 · matplotlib/matplotlib
Description: Bug report Affects: commit 7b5ff33 (master, 23 Aug 2018) An attempt to plot a single point at coords (2,3) with RGB color (120,130,140) throws an error message remarking about argument shapes mismatching. Message should be about RGB valu...
Open Graph Description: Bug report Affects: commit 7b5ff33 (master, 23 Aug 2018) An attempt to plot a single point at coords (2,3) with RGB color (120,130,140) throws an error message remarking about argument shapes misma...
X Description: Bug report Affects: commit 7b5ff33 (master, 23 Aug 2018) An attempt to plot a single point at coords (2,3) with RGB color (120,130,140) throws an error message remarking about argument shapes misma...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/11919
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Wrong Error Message","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\nAffects: commit 7b5ff33 (master, 23 Aug 2018)\r\n\r\nAn attempt to plot a single point at coords (2,3) with RGB color (120,130,140) throws an error message remarking about argument shapes mismatching. Message should be about RGB values outside range 0 to 1.\r\n\r\n**Code for reproduction**\r\n\r\n```python\r\nax.scatter(np.array([2]), np.array([3]), c=np.array([[120,130,140]]))\r\n```\r\n```\r\nValueError: c of shape (1, 3) not acceptable as a color sequence for x with size 1, y with size 1\r\n```\r\n\r\nThis is ok:\r\n\r\n```python\r\nax.scatter(np.array([2]), np.array([3]), c=np.array([[120,130,140]]) / 255.0 )\r\n```\r\n\r\n**Actual outcome**\r\n\r\nSee above.\r\n\r\n**Expected outcome**\r\n\r\nSuggestion: error message could be about RGB values outside of 0 to 1 range.\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**Trace**\r\n\r\n```python\r\n File \"/home/d/code/matplotlib/lib/matplotlib/axes/_axes.py\", line 4223, in scatter\r\n .format(nc=n_elem, xs=x.size, ys=y.size)\r\nValueError: 'c' argument has 3 elements, which is not acceptable for use with 'x' with size 1, 'y' with size 1.\r\n\r\n```\r\n\r\npython 2 gives slightly different trace:\r\n```python\r\n/home/d/.conda/envs/py2_dp/lib/python2.7/site-packages/matplotlib-2.2.2-py2.7-linux-x86_64.egg/matplotlib/axes/_axes.pyc in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs)\r\n 4277 raise ValueError(\"c of shape {} not acceptable as a color \"\r\n 4278 \"sequence for x with size {}, y with size {}\"\r\n-\u003e 4279 .format(c.shape, x.size, y.size))\r\n 4280 else:\r\n 4281 colors = None # use cmap, norm after collection is created\r\n\r\nValueError: c of shape (1, 3) not acceptable as a color sequence for x with size 1, y with size 1\r\n```\r\n\r\n**Matplotlib version**\r\n\r\n * Operating system: Ubuntu 16.04\r\n * Matplotlib version: commit 7b5ff33 (master, 23 Aug 2018)\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): \u003cobject object at 0x7f8885d87190\u003e\r\n * Python version: 3.5.5\r\n * Jupyter version (if applicable): none\r\n * Other libraries: numpy\r\n\r\nHow I installed matplotlib:\r\n\r\n1. Create new conda env with python 3.5.5\r\n2. git clone matplotlib master\r\n3. pip install -e /path/to/cloned-repo\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/davidleejy","@type":"Person","name":"davidleejy"},"datePublished":"2018-08-23T03:07:45.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/11919/matplotlib/issues/11919"}
| 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:ade8a9b1-78e1-5770-92c1-0e0853f6f043 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A91A:DFD60:5272381:732CA00:6A550DB7 |
| html-safe-nonce | 528637eb403c9104f79b624cde8bc07033d4b384381ff265244a7f6103c412da |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOTFBOkRGRDYwOjUyNzIzODE6NzMyQ0EwMDo2QTU1MERCNyIsInZpc2l0b3JfaWQiOiIyNDA2NTQ3MTM5MjUxNzM1OTkxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 559081bfc14c103e767f654865a022c15056aa6291a67ed5f74114a8da7a35e5 |
| hovercard-subject-tag | issue:353204329 |
| 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/11919/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2563c8c6769ed66f0939d14390fa14704d3a95937c8a60123c3fa2a0a006de75/matplotlib/matplotlib/issues/11919 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2563c8c6769ed66f0939d14390fa14704d3a95937c8a60123c3fa2a0a006de75/matplotlib/matplotlib/issues/11919 |
| og:image:alt | Bug report Affects: commit 7b5ff33 (master, 23 Aug 2018) An attempt to plot a single point at coords (2,3) with RGB color (120,130,140) throws an error message remarking about argument shapes misma... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | davidleejy |
| hostname | github.com |
| expected-hostname | github.com |
| None | 682d273eacb2ac51680c6eb9c0b270f029f7ce74c32090f319083c34497e28a5 |
| 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 | 0f2adbaa4b43ea302b02981f637a782ae92ed6dc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width