Title: Unhelpful ValueError raised when color array is incorrect format · Issue #15727 · matplotlib/matplotlib · GitHub
Open Graph Title: Unhelpful ValueError raised when color array is incorrect format · Issue #15727 · matplotlib/matplotlib
X Title: Unhelpful ValueError raised when color array is incorrect format · Issue #15727 · matplotlib/matplotlib
Description: Bug report Bug summary When colors passed to a plot are provided as tuples in the range [0, 255] instead of [0, 1], the error raised relates to the shape of the data (which is correct), not the values of the data. Code for reproduction i...
Open Graph Description: Bug report Bug summary When colors passed to a plot are provided as tuples in the range [0, 255] instead of [0, 1], the error raised relates to the shape of the data (which is correct), not the val...
X Description: Bug report Bug summary When colors passed to a plot are provided as tuples in the range [0, 255] instead of [0, 1], the error raised relates to the shape of the data (which is correct), not the val...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/15727
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unhelpful ValueError raised when color array is incorrect format","articleBody":"### Bug report\r\n\r\n**Bug summary**\r\nWhen colors passed to a plot are provided as tuples in the range `[0, 255]` instead of `[0, 1]`, the error raised relates to the shape of the data (which is correct), not the values of the data.\r\n\r\n**Code for reproduction**\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\n\r\nplt.scatter([0, 1], [0, 1], c=[(255, 0, 0), (0, 255, 0)])\r\n```\r\n\r\n**Actual outcome**\r\n\r\n```python\r\nValueError: 'c' argument has 2 elements, which is not acceptable for use with 'x' with size 2, 'y' with size 2.\r\n```\r\n\r\n_Edit_:\r\n```python\r\nValueError: RGBA values should be within 0-1 range\r\n```\r\nis also raised, however it is less prominent than the \"size\" error, which should not be raised at all\r\n\r\n**Expected outcome**\r\nA single, specific error message:\r\n```python\r\nValueError: RGBA values should be within 0-1 range\r\n```\r\n\r\n**Matplotlib version**\r\n * Operating system: Windows 10\r\n * Matplotlib version: 3.1.2\r\n * Matplotlib backend: Qt5Agg\r\n * Python version: 3.7.3\r\n\r\nInstalled matplotlib from conda\r\n\r\n","author":{"url":"https://github.com/TTitcombe","@type":"Person","name":"TTitcombe"},"datePublished":"2019-11-19T10:47:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/15727/matplotlib/issues/15727"}
| 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:8dc1431e-cbb6-e681-2264-179cc6bc82ee |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9930:CD74F:4CB326C:6C1B020:6A570380 |
| html-safe-nonce | ddffa0b23cce95750ee38d440d1f659ebc4eba4640698710c9b9ca2a77563de3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OTMwOkNENzRGOjRDQjMyNkM6NkMxQjAyMDo2QTU3MDM4MCIsInZpc2l0b3JfaWQiOiI4ODkzMjE5NjYzNTMxOTM0NTkyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | bdd3e68606d1a237778c71ddbaf2438db58034c78623ce81f4364285450806cb |
| hovercard-subject-tag | issue:524927269 |
| 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/15727/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7c570aef10d25e1b52743e36e8c2e4db3b04079971028c0ca740bf2757874327/matplotlib/matplotlib/issues/15727 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7c570aef10d25e1b52743e36e8c2e4db3b04079971028c0ca740bf2757874327/matplotlib/matplotlib/issues/15727 |
| og:image:alt | Bug report Bug summary When colors passed to a plot are provided as tuples in the range [0, 255] instead of [0, 1], the error raised relates to the shape of the data (which is correct), not the val... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | TTitcombe |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb29e5f807bd95e41196adfbc6d28f9af12d89830d8b684f3e871774ddff2fc |
| 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 | b056788a129fb0194b61f2ebb4c43f6a9f4dfd27 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width