Title: allow using categorical data for color, marker, size, … · Issue #6214 · matplotlib/matplotlib · GitHub
Open Graph Title: allow using categorical data for color, marker, size, … · Issue #6214 · matplotlib/matplotlib
X Title: allow using categorical data for color, marker, size, … · Issue #6214 · matplotlib/matplotlib
Description: currently specifying an array for color or size, only works for continuous data. using markers and colors mapped to subsets based on categorical data is hard and manual (basically you subset the data in a loop and call plot multiple time...
Open Graph Description: currently specifying an array for color or size, only works for continuous data. using markers and colors mapped to subsets based on categorical data is hard and manual (basically you subset the da...
X Description: currently specifying an array for color or size, only works for continuous data. using markers and colors mapped to subsets based on categorical data is hard and manual (basically you subset the da...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/6214
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"allow using categorical data for color, marker, size, …","articleBody":"currently specifying an array for color or size, only works for continuous data. using markers and colors mapped to subsets based on categorical data is hard and manual (basically you subset the data in a loop and call plot multiple times).\n\ni thought it would be hard as list-of-string already means something for some parameters (markers and colors can be specified as strings). but there is pandas’ [category dtype](http://pandas.pydata.org/pandas-docs/stable/categorical.html).\n\ni propose that using a categorical vector for one of these parameters should be automatically mapped to a palette of colors/markers when specified as `c` or `marker`.\n\n``` py\n# with A, B, C, being either categorical or quantitative,\n# S being quantitative, and M being categorical\nplt.scatter('A', 'B', s='S', c='C', marker='M', data=df)\n\n# of course also works with arrays, and bool acts like categorical data:\nplt.scatter(arr[:,0], arr[:,1], c=arr[:,-1] \u003e 0)\n```\n## more palettes than just the colormap\n\nthe color palette for categorical data would be `plt.rcParams['axes.prop_cycle'].by_key()['color']`, the marker palette a new `rcParam` (maybe?)\n\nthose palettes would be cycled if there are too many categories.\n## legends\n- categorical: legend\n- discrete: (ordered legend or segmented bar)\n- continuous: bar (colorbar for color, isosceles trapezoid for size)\n## open questions\n- are integers treated as quantitiative + discrete (legend containing all separate values) or continuous (bar)\n- how to specify if a legend/colorbar/sizebar should created? it makes sense to automatically do it if we use the `data=` interface\n","author":{"url":"https://github.com/flying-sheep","@type":"Person","name":"flying-sheep"},"datePublished":"2016-03-23T16:27:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":23},"url":"https://github.com/6214/matplotlib/issues/6214"}
| 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:a99812cc-fbea-73bf-5e6a-9373b44e62ed |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8C84:19F60D:BAE6E4:F72D31:6A518F72 |
| html-safe-nonce | 82886327115f6393b8b10ea374371a2c6eb592cfa2dd1da605063135c721bd1e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Qzg0OjE5RjYwRDpCQUU2RTQ6RjcyRDMxOjZBNTE4RjcyIiwidmlzaXRvcl9pZCI6IjQ4MzA2NTU0MTQ0NDUxMTcyOTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c0ed1a83acbc8974bb99fecc32c77961f0bd0e09fb40906c0b3a435b68c26389 |
| hovercard-subject-tag | issue:143009924 |
| 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/6214/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a36e0aa2de8322e8398ac4f82adae2296eb5f77f4698907d0256eca9125c4193/matplotlib/matplotlib/issues/6214 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a36e0aa2de8322e8398ac4f82adae2296eb5f77f4698907d0256eca9125c4193/matplotlib/matplotlib/issues/6214 |
| og:image:alt | currently specifying an array for color or size, only works for continuous data. using markers and colors mapped to subsets based on categorical data is hard and manual (basically you subset the da... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | flying-sheep |
| 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 | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width