Title: Inconsistent shape handling of parameter c compared to x/y in scatter() · Issue #12735 · matplotlib/matplotlib · GitHub
Open Graph Title: Inconsistent shape handling of parameter c compared to x/y in scatter() · Issue #12735 · matplotlib/matplotlib
X Title: Inconsistent shape handling of parameter c compared to x/y in scatter() · Issue #12735 · matplotlib/matplotlib
Description: Bug report As described in #11663 (review): Something funny is going on here (I know it was already there before, but still seems worth pointing out): we take x and y of any shapes and flatten them (they just need to have the same size),...
Open Graph Description: Bug report As described in #11663 (review): Something funny is going on here (I know it was already there before, but still seems worth pointing out): we take x and y of any shapes and flatten them...
X Description: Bug report As described in #11663 (review): Something funny is going on here (I know it was already there before, but still seems worth pointing out): we take x and y of any shapes and flatten them...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/12735
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inconsistent shape handling of parameter c compared to x/y in scatter()","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\nAs described in https://github.com/matplotlib/matplotlib/pull/11663#pullrequestreview-171359644:\r\n\r\nSomething funny is going on here (I know it was already there before, but still seems worth pointing out): we take x and y of any shapes and flatten them (they just need to have the same size), but `c` has to match either the shape of `x` or `y`, not just the size.\r\n\r\nIn other words the following \"work\" (i.e. perform an implicit ravel()):\r\n```\r\nscatter(np.arange(12).reshape((3, 4)), np.arange(12).reshape((4, 3)), c=np.arange(12).reshape((3, 4)))\r\nscatter(np.arange(12).reshape((3, 4)), np.arange(12).reshape((4, 3)), c=np.arange(12).reshape((4, 3)))\r\n```\r\nbut the following fail:\r\n```\r\nscatter(np.arange(12).reshape((3, 4)), np.arange(12).reshape((4, 3)), c=np.arange(12).reshape((6, 2)))\r\n# and even\r\nscatter(np.arange(12).reshape((3, 4)), np.arange(12).reshape((4, 3)), c=np.arange(12))\r\n```\r\nOf course that last one has the best error message (irony intended):\r\n\r\n\u003e ValueError: 'c' argument has 12 elements, which is not acceptable for use with 'x' with size 12, 'y' with size 12.\r\n\r\n\r\n\r\n","author":{"url":"https://github.com/timhoffm","@type":"Person","name":"timhoffm"},"datePublished":"2018-11-04T12:44:03.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":9},"url":"https://github.com/12735/matplotlib/issues/12735"}
| 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:80233789-b4b4-9dcb-0232-e7e22b96fea0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 92E8:4AC5:469C05:5F13E0:6A55537E |
| html-safe-nonce | 4f69aa7d622f03e9dd8c6b426a484af19a271e4856d50764c1f735c8f31adb4d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MkU4OjRBQzU6NDY5QzA1OjVGMTNFMDo2QTU1NTM3RSIsInZpc2l0b3JfaWQiOiIzNjc4NDY4MzkyMTk1ODA2MDc4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ca95968c7b1f7fd1e47efc1082785ceacc7c9757abd146797c15b073eb5a10ae |
| hovercard-subject-tag | issue:377149067 |
| 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/12735/issue_layout |
| twitter:image | https://opengraph.githubassets.com/95cb0d0786ab5297f389c70213e64dc0c5438d639f60f29d857e4b04297384d4/matplotlib/matplotlib/issues/12735 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/95cb0d0786ab5297f389c70213e64dc0c5438d639f60f29d857e4b04297384d4/matplotlib/matplotlib/issues/12735 |
| og:image:alt | Bug report As described in #11663 (review): Something funny is going on here (I know it was already there before, but still seems worth pointing out): we take x and y of any shapes and flatten them... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | timhoffm |
| hostname | github.com |
| expected-hostname | github.com |
| None | cd9eea424140838b22e9eabd53d92b5702617ddd6d76efcd3a37f08d44309ca5 |
| 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 | 3084b9f587e8f1e19803bbe0c77ac77ce3c99c5c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width