Title: [New Feature] Insert color fill parameter to Boxplot instead of using 'patch_artist' · Issue #17959 · matplotlib/matplotlib · GitHub
Open Graph Title: [New Feature] Insert color fill parameter to Boxplot instead of using 'patch_artist' · Issue #17959 · matplotlib/matplotlib
X Title: [New Feature] Insert color fill parameter to Boxplot instead of using 'patch_artist' · Issue #17959 · matplotlib/matplotlib
Description: Feature Request I'm new to matplotlib and I don't know if there is a specific reason for the boxplot fill coloring to be the way it is. I only wonder if it could be done in a more straight forward manner than what is shown in here. The i...
Open Graph Description: Feature Request I'm new to matplotlib and I don't know if there is a specific reason for the boxplot fill coloring to be the way it is. I only wonder if it could be done in a more straight forward ...
X Description: Feature Request I'm new to matplotlib and I don't know if there is a specific reason for the boxplot fill coloring to be the way it is. I only wonder if it could be done in a more straight ...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/17959
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[New Feature] Insert color fill parameter to Boxplot instead of using 'patch_artist'","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### Feature Request\r\n\r\nI'm new to matplotlib and I don't know if there is a specific reason for the boxplot fill coloring to be the way it is. I only wonder if it could be done in a more straight forward manner than what is shown in [here](https://stackoverflow.com/questions/20289091/python-matplotlib-filled-boxplots).\r\n\r\nThe idea for this \"new feature\" would be to use a `color` parameter that recieves either a list of supported colors or a single color (e.g. `color = 'red'`) that specifies the colors to be applied to each one of the boxplots in the ax.\r\n\r\n**How it is currently done**\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\nimport numpy as np\r\n\r\ndata = [np.random.normal(0, std, 1000) for std in range(1, 6)]\r\n\r\nbox = plt.boxplot(data, notch=True, patch_artist=True)\r\n\r\ncolors = ['cyan', 'lightblue', 'lightgreen', 'tan', 'pink']\r\nfor patch, color in zip(box['boxes'], colors):\r\n patch.set_facecolor(color)\r\n\r\nplt.show()\r\n```\r\n\r\n**The idea for this 'New Feature'**\r\n\r\n\u003c!--The output produced by the above code, which may be a screenshot, console output, etc.--\u003e\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\nimport numpy as np\r\n\r\ndata = [np.random.normal(0, std, 1000) for std in range(1, 6)]\r\n\r\ncolors = ['cyan', 'lightblue', 'lightgreen', 'tan', 'pink']\r\n\r\n# or maybe 'c = colors', 'face_colors = colors'...\r\nplt.boxplot(data, notch=True, colors = colors)\r\n\r\nplt.show()\r\n```\r\n\r\nAny thoughts on this idea?\r\n\r\n**Matplotlib version**\r\n\u003c!--Please specify your platform and versions of the relevant libraries you are using:--\u003e\r\n * Operating system: Windows 10 2004\r\n * Matplotlib version: 3.2.2\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): TkAgg\r\n * Python version: 3.7.7\r\n * Jupyter version (if applicable): 2.1.5\r\n * Other libraries: \r\n\r\n","author":{"url":"https://github.com/lfenzo","@type":"Person","name":"lfenzo"},"datePublished":"2020-07-18T12:45:24.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/17959/matplotlib/issues/17959"}
| 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:eee9b56c-3c97-c4ac-4fbc-bba5831724b3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A810:1EBA6F:15E903:1E580A:6A532F10 |
| html-safe-nonce | 4f025fa05057fadf3eec3e5acc64fccc609083f24109031f6dede27efa058c28 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBODEwOjFFQkE2RjoxNUU5MDM6MUU1ODBBOjZBNTMyRjEwIiwidmlzaXRvcl9pZCI6IjIzNDY3MDI4NDczNjA1NzcyOTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 67bf5df1ce32b6fef44dc3bde5e61f4b53316c116ffe3881a77a93be8d88a5fb |
| hovercard-subject-tag | issue:660130154 |
| 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/17959/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fe4a4f7b73a2d0fe378fb6bedf0f03dba077a7d309699d2cafafe84792206f32/matplotlib/matplotlib/issues/17959 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fe4a4f7b73a2d0fe378fb6bedf0f03dba077a7d309699d2cafafe84792206f32/matplotlib/matplotlib/issues/17959 |
| og:image:alt | Feature Request I'm new to matplotlib and I don't know if there is a specific reason for the boxplot fill coloring to be the way it is. I only wonder if it could be done in a more straight forward ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lfenzo |
| 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