Title: [Bug]: Updating the facecolors of a collection before its first draw has no effect · Issue #24479 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: Updating the facecolors of a collection before its first draw has no effect · Issue #24479 · matplotlib/matplotlib
X Title: [Bug]: Updating the facecolors of a collection before its first draw has no effect · Issue #24479 · matplotlib/matplotlib
Description: Bug summary Create e.g. a pathcollection (a scatter plot) not mapping any array, but with directly set colors; then update one of the facecolors before the first draw of the collection. This change has no effect and gets cancelled. Code ...
Open Graph Description: Bug summary Create e.g. a pathcollection (a scatter plot) not mapping any array, but with directly set colors; then update one of the facecolors before the first draw of the collection. This change...
X Description: Bug summary Create e.g. a pathcollection (a scatter plot) not mapping any array, but with directly set colors; then update one of the facecolors before the first draw of the collection. This change...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/24479
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Updating the facecolors of a collection before its first draw has no effect","articleBody":"### Bug summary\n\nCreate e.g. a pathcollection (a scatter plot) not mapping any array, but with directly set colors; then update one of the facecolors before the first draw of the collection. This change has no effect and gets cancelled.\n\n### Code for reproduction\n\n```python\nimport matplotlib.pyplot as plt\r\n\r\nsc1 = plt.scatter([0, 1, 2], [0, 1, 2], c=[\"r\", \"g\", \"b\"])\r\nsc2 = plt.scatter([0, 1, 2], [2, 3, 4], c=[\"r\", \"g\", \"b\"])\r\n# Update sc1 before the first draw.\r\nsc1.get_facecolors()[2] = (0, 0, 0, 1) # i.e. black.\r\nplt.gcf().canvas.draw()\r\n# Update sc2 after the first draw.\r\nsc2.get_facecolors()[2] = (0, 0, 0, 1) # i.e. black\r\n\r\nplt.show()\n```\n\n\n### Actual outcome\n\n\r\nNote that the third point of sc1 is incorrectly blue, whereas the third point of sc2 is correctly black.\n\n### Expected outcome\n\nBoth third points are black.\n\n### Additional information\n\nFirst noted by @chahak13 in https://github.com/matplotlib/matplotlib/pull/24474#discussion_r1024536389.\r\nI haven't done a full bisect but did check that this broke at some point between 3.3.4 and 3.4.0, and I suspect #18480 introduced the issue (in the changes related to update_scalarmappable); attn @efiring.\n\n### Operating system\n\nfedora37\n\n### Matplotlib Version\n\n3.7.0.dev538+g9b4985e185\n\n### Matplotlib Backend\n\nqtagg\n\n### Python version\n\n3.10\n\n### Jupyter version\n\nENOSUCHLIB\n\n### Installation\n\ngit checkout","author":{"url":"https://github.com/anntzer","@type":"Person","name":"anntzer"},"datePublished":"2022-11-16T22:41:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/24479/matplotlib/issues/24479"}
| 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:0379800a-fa4c-20a1-4d1c-f54bd37391fb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B3E6:93CC4:27877DE:384EECC:6A510671 |
| html-safe-nonce | c4433810718cf18b7f70f7571deb40a5d45c6ed9199705b8227378ee9a0715db |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCM0U2OjkzQ0M0OjI3ODc3REU6Mzg0RUVDQzo2QTUxMDY3MSIsInZpc2l0b3JfaWQiOiIxMTc5MDg5MDQ1NjEyOTg4MDE4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 549a750735d6497ea86fcaccfce015dd24afafbbf5bbf0fae2fe2851068c8c99 |
| hovercard-subject-tag | issue:1452380210 |
| 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/24479/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b81a162ae11f04034842cc2d41e1828ce767982922df5f7aa16fee01342f9b6c/matplotlib/matplotlib/issues/24479 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b81a162ae11f04034842cc2d41e1828ce767982922df5f7aa16fee01342f9b6c/matplotlib/matplotlib/issues/24479 |
| og:image:alt | Bug summary Create e.g. a pathcollection (a scatter plot) not mapping any array, but with directly set colors; then update one of the facecolors before the first draw of the collection. This change... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | anntzer |
| hostname | github.com |
| expected-hostname | github.com |
| None | b076e100febaa00374cd89239f915d00dd3187f7c68b12bc2b7688181305344d |
| 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 | 2d129404fc45ea64edb1b98567c53e55b395536f |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width