Title: ENH: Implement gapcolor for patch edges by pirzada-ahmadfaraz · Pull Request #30967 · matplotlib/matplotlib · GitHub
Open Graph Title: ENH: Implement gapcolor for patch edges by pirzada-ahmadfaraz · Pull Request #30967 · matplotlib/matplotlib
X Title: ENH: Implement gapcolor for patch edges by pirzada-ahmadfaraz · Pull Request #30967 · matplotlib/matplotlib
Description: Closes #30934 Summary This PR adds support for the gapcolor property in Patches, similar to the existing gapcolor feature in Line2D and LineCollection. This allows drawing "stripey" patch edges with two alternating colors in dashed patterns. Use Case Drawing unfilled patches on backgrounds of unknown color (very light or very dark), where alternating black/white edges ensure the patch is always visible. Example import matplotlib.pyplot as plt from matplotlib.patches import Rectangle fig, ax = plt.subplots() rect = Rectangle((0.1, 0.1), 0.5, 0.5, fill=False, edgecolor='black', gapcolor='white', linestyle='--', linewidth=3) ax.add_patch(rect) plt.show() Changes Add gapcolor parameter to Patch.__init__ Add get_gapcolor() and set_gapcolor() methods Add is_dashed() method to check if edge is dashed Modify _draw_paths_with_artist_properties() to draw gaps first with inverse dash pattern when gapcolor is set Update update_from() to copy gapcolor Add tests for the new functionality Implementation Following the same approach as Line2D: If dashed and gapcolor is set, first draw the path with gapcolor using an inverse dash pattern (fills the gaps) Then draw the normal dashed edge on top
Open Graph Description: Closes #30934 Summary This PR adds support for the gapcolor property in Patches, similar to the existing gapcolor feature in Line2D and LineCollection. This allows drawing "stripey" patch...
X Description: Closes #30934 Summary This PR adds support for the gapcolor property in Patches, similar to the existing gapcolor feature in Line2D and LineCollection. This allows drawing "stripey&quo...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/30967
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:3c6555d7-82b4-9a85-49f3-4ec88c30121b |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C25A:F8982:33E526:451FE7:6A52ED82 |
| html-safe-nonce | bee7a30b59991e62b543c7d6918da0e8cce20c19ad7fe2290980cd225acb70c5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjVBOkY4OTgyOjMzRTUyNjo0NTFGRTc6NkE1MkVEODIiLCJ2aXNpdG9yX2lkIjoiODE1NDI2ODExNjc2NzgxOTU0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 6a9179661b82a5560cf5500b5b1acc1b86524f4aace25dd019a0bd488cef0291 |
| hovercard-subject-tag | pull_request:3176774363 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/matplotlib/matplotlib/pull/30967/files |
| twitter:image | https://avatars.githubusercontent.com/u/136244856?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/136244856?s=400&v=4 |
| og:image:alt | Closes #30934 Summary This PR adds support for the gapcolor property in Patches, similar to the existing gapcolor feature in Line2D and LineCollection. This allows drawing "stripey" patch... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| 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