Title: [MNT]: Confusing edgecolor behavior for Patch and Collection · Issue #29261 · matplotlib/matplotlib · GitHub
Open Graph Title: [MNT]: Confusing edgecolor behavior for Patch and Collection · Issue #29261 · matplotlib/matplotlib
X Title: [MNT]: Confusing edgecolor behavior for Patch and Collection · Issue #29261 · matplotlib/matplotlib
Description: Noted while reviewing documentation on the current behavoir in #29252. Summary Patches and Collections do not draw edges by default. This was introduced in #5596 for matplotlib 2.0. It seems that this was first achieved by a linewidth 0,...
Open Graph Description: Noted while reviewing documentation on the current behavoir in #29252. Summary Patches and Collections do not draw edges by default. This was introduced in #5596 for matplotlib 2.0. It seems that t...
X Description: Noted while reviewing documentation on the current behavoir in #29252. Summary Patches and Collections do not draw edges by default. This was introduced in #5596 for matplotlib 2.0. It seems that t...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/29261
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[MNT]: Confusing edgecolor behavior for Patch and Collection","articleBody":"Noted while reviewing documentation on the current behavoir in #29252.\r\n\r\n### Summary\r\n\r\nPatches and Collections do not draw edges by default. This was introduced in #5596 for matplotlib 2.0. It seems that this was first achieved by a linewidth 0, but it this was changed to using an edgecolor of \"none\" while maintaining a finite linewidth.\r\n\r\nAs a consequence `rcParams[\"patch.edgecolor\"]` does not have an effect by default. There are, however two cases when `rcParams[\"patch.edgecolor\"]` becomes relevant:\r\n1. If facecolor is \"none\", Patch and Collection take `rcParams[\"patch.edgecolor\"]` as edgecolor.\r\n I assume, this is done to prevent the artist being completely invisible (no facecolor and no edgecolor).\r\n2. If `rcParams[\"patch.force_edgecolor\"]` is set to true, `rcParams[\"patch.edgecolor\"]` is used instead of \"none\" as the\r\n\r\nThis is overall very confusing.\r\n\r\nPing @efiring, who introduced `rcParams[\"patch.force_edgecolor\"]` in #6904. Can you comment on the background and whether the proposal below is a reasonable alternative?\r\n\r\n### Proposed fix\r\n\r\nCan we switch to the following logic: `patch.edgecolor` is generally used as edgecolor and now defaults to \"none\" (to achieve the same behavior as before). To handle case 1. (prevent invisible artists) introduce a new `rcParams[\"patch.edgecolor_fallback\"]` that has a special color only for that case.\r\n\r\n### Needed changes to default rcParams\r\nmatplotlibrc before:\r\n```\r\n#patch.edgecolor: black\r\n#patch.force_edgecolor: False\r\n```\r\nmatplotlibrc after\r\n```\r\n#patch.edgecolor: \"none\" # default edgecolor for Patch and Collection\r\n#patch.edgecolor_fallback: \"black\" # edgecolor to be used if facecolor is \"none\" to prevent completely invisible artists\r\n```\r\n\r\n### Needed changes to styles\r\nExisting styles would migrate\r\n\r\n- If `patch.force_edgecolor` was False:\r\n from:\r\n ```\r\n patch.edgecolor: COLOR\r\n #patch.force_edgecolor: False\r\n ```\r\n to\r\n ```\r\n #patch.edgecolor: \"none\"\r\n patch.edgecolor_fallback: COLOR\r\n ```\r\n- If `patch.force_edgecolor` was True:\r\n from:\r\n ```\r\n patch.edgecolor: COLOR\r\n patch.force_edgecolor: True\r\n ```\r\n to\r\n ```\r\n patch.edgecolor: COLOR\r\n patch.edgecolor_fallback: COLOR\r\n ```\r\n\r\n### Transition path\r\n- `patch.force_edgecolor` gets deprecated and raises a warning when used on rcParams.\r\n- styles that don't use any of `patch.edgecolor` or `patch.force_edgecolor` do not have to do anything. \r\n- styles that have set `patch.edgecolor` but not `patch.force_edgecolor` are a very edge case. They either have overlooked that the default `force_edgecolor=False` makes the setting ineffective, or they have intentionally only configured the somewhat arcane edge color fallback for non-filled artists. In the former case, they get \"auto-fixed\" through the new behavior. I'd argue that we can affort to not runtime-warn on the latter case (but if really wanted, one could add a check at least for loading stylesheets).","author":{"url":"https://github.com/timhoffm","@type":"Person","name":"timhoffm"},"datePublished":"2024-12-08T23:44:21.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":12},"url":"https://github.com/29261/matplotlib/issues/29261"}
| 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:9e52b6f7-565c-2354-26b5-1ad61962ce6c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 828E:FAECF:19C024B:221CE29:6A52CA34 |
| html-safe-nonce | 5ed187540e99e056204f0169fe561e04b6f8a34ef867f1ff7ce2a74338bbfe55 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MjhFOkZBRUNGOjE5QzAyNEI6MjIxQ0UyOTo2QTUyQ0EzNCIsInZpc2l0b3JfaWQiOiI3MjQ4ODM4MTg1MjUzNTIxOTcyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 7b5eedc7f7b81afac604810776235070b581caa59dc3757ddb5ee4d2a086cee5 |
| hovercard-subject-tag | issue:2725615920 |
| 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/29261/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e487c602b050ebdcec9223720772b0042ed4f68a12dd4025b7041a2c25b0e676/matplotlib/matplotlib/issues/29261 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e487c602b050ebdcec9223720772b0042ed4f68a12dd4025b7041a2c25b0e676/matplotlib/matplotlib/issues/29261 |
| og:image:alt | Noted while reviewing documentation on the current behavoir in #29252. Summary Patches and Collections do not draw edges by default. This was introduced in #5596 for matplotlib 2.0. It seems that t... |
| 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 | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width