Title: [ENH]: Different edgecolor and hatch color in bar plot · Issue #26074 · matplotlib/matplotlib · GitHub
Open Graph Title: [ENH]: Different edgecolor and hatch color in bar plot · Issue #26074 · matplotlib/matplotlib
X Title: [ENH]: Different edgecolor and hatch color in bar plot · Issue #26074 · matplotlib/matplotlib
Description: Problem Colored edges look ugly: I want bars with black edges and colored hatch: My current workaround is to draw the bars twice, once with colored hatch and then a second time only with black edges: import matplotlib.pyplot as plt impor...
Open Graph Description: Problem Colored edges look ugly: I want bars with black edges and colored hatch: My current workaround is to draw the bars twice, once with colored hatch and then a second time only with black edge...
X Description: Problem Colored edges look ugly: I want bars with black edges and colored hatch: My current workaround is to draw the bars twice, once with colored hatch and then a second time only with black edge...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/26074
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[ENH]: Different edgecolor and hatch color in bar plot","articleBody":"### Problem\n\nColored edges look ugly:\r\n\r\n\r\n\r\nI want bars with black edges and colored hatch:\r\n\r\n\r\n\r\nMy current workaround is to draw the bars twice, once with colored hatch and then a second time only with black edges:\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\nimport numpy as np\r\n\r\nwidth = 0.35\r\nx = np.arange(4) + 1\r\ny_red = [1, 3, 1, 4]\r\ny_blue = [2, 2, 4, 1]\r\n\r\nplt.bar(x - 0.5 * width, y_red, width, label=\"Height of red bars\", hatch=\"////\", facecolor=(0, 0, 0, 0), edgecolor=\"red\")\r\nplt.bar(x - 0.5 * width, y_red, width, facecolor=(0, 0, 0, 0), edgecolor=\"black\")\r\n\r\nplt.bar(x + 0.5 * width, y_blue, width, label=\"Height of blue bars\", hatch=r\"\\\\\", facecolor=(0, 0, 0, 0), edgecolor=\"blue\")\r\nplt.bar(x + 0.5 * width, y_blue, width, facecolor=(0, 0, 0, 0), edgecolor=\"black\")\r\n\r\nplt.xticks(x)\r\nplt.yticks([0, 1, 2, 3, 4])\r\nplt.legend()\r\nplt.savefig(\"hatch.png\")\r\nplt.show()\r\n```\r\n\r\nThis workaround is not optimal because the legend is wrong.\n\n### Proposed solution\n\nI propose a `hatchcolor` parameter which is independent of `edgecolor`.","author":{"url":"https://github.com/99991","@type":"Person","name":"99991"},"datePublished":"2023-06-05T07:46:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/26074/matplotlib/issues/26074"}
| 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:5af5585e-8397-723f-93d9-8a848de12ddd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 89E4:20874E:790736:A1E309:6A52A6A4 |
| html-safe-nonce | 26d32861a981ed13d709a802e55139dc3fce988cbe3beb81440c999c689c2292 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OUU0OjIwODc0RTo3OTA3MzY6QTFFMzA5OjZBNTJBNkE0IiwidmlzaXRvcl9pZCI6IjczODkxMDY4MDQ5MTQwMzg0MzYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8697c8608ee2d826014516df9189bbd6bf1e784bda52f1536851399cb3848c0d |
| hovercard-subject-tag | issue:1741179954 |
| 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/26074/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1fa2ba797b1db8f6dbe7ee6b8a8ba43c1fc357cf0613c1b3d1ad734e8e59981d/matplotlib/matplotlib/issues/26074 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1fa2ba797b1db8f6dbe7ee6b8a8ba43c1fc357cf0613c1b3d1ad734e8e59981d/matplotlib/matplotlib/issues/26074 |
| og:image:alt | Problem Colored edges look ugly: I want bars with black edges and colored hatch: My current workaround is to draw the bars twice, once with colored hatch and then a second time only with black edge... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | 99991 |
| 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