Title: ENH: Allow for non-normalized and transformed markers by ImportanceOfBeingErnest · Pull Request #16773 · matplotlib/matplotlib · GitHub
Open Graph Title: ENH: Allow for non-normalized and transformed markers by ImportanceOfBeingErnest · Pull Request #16773 · matplotlib/matplotlib
X Title: ENH: Allow for non-normalized and transformed markers by ImportanceOfBeingErnest · Pull Request #16773 · matplotlib/matplotlib
Description: PR Summary This PR allows markers to be non-normalized or transformed: MarkerStyle now gets a normalize_path argument, which defaults to True, but can be set False to allow for custom paths that are input to not be normalized to the unit square. That is, the following two will result in the same plot p = Path([[-1,-1],[1,-1],[0,1]]) ax.scatter(...., s=20**2, marker=MarkerStyle(p)) ax.scatter(...., s=1, marker=MarkerStyle(p.transformed(Affine2D().scale(10)), normalize_path=False)) MarkerStyle now gets a set_transform method, that allows to externally set a transform to the marker. I.e., the following two result in the same plot ax.scatter(...., s=20**2, marker=MarkerStyle("s")) m = MarkerStyle("s") m.set_transform(Affine2D().scale(20)) ax.scatter(...., s=1, marker=m) Why is this useful? Until now, it is impossible use arbitrary custom markers. Custom markers are always normalized to the unit square. So for a given path, the size and center point of the marker are changed by matplotlib. Common problems: You want to rotate a given marker without it changing size. See https://stackoverflow.com/questions/53227057/size-distortion-when-rotating-custom-path-marker-in-matplotlib or https://stackoverflow.com/questions/49660174/rotate-existing-matplotlib-markers You want to create a custom marker that is sized relative to another marker, see e.g. https://matplotlib.org/gallery/lines_bars_and_markers/scatter_piecharts.html, without setting its size via the markersize property of the artist, or that is off-centered. Finally, you may want to create a set of markers that are uniform in area, or perceptually uniform, as desired in #15703 PR Checklist Has Pytest style unit tests Code is Flake 8 compliant New features are documented, with examples if plot related Documentation is sphinx and numpydoc compliant Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there) Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way
Open Graph Description: PR Summary This PR allows markers to be non-normalized or transformed: MarkerStyle now gets a normalize_path argument, which defaults to True, but can be set False to allow for custom paths that a...
X Description: PR Summary This PR allows markers to be non-normalized or transformed: MarkerStyle now gets a normalize_path argument, which defaults to True, but can be set False to allow for custom paths that a...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/16773
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:5ddd43a3-1bdc-ab4a-c63f-6d4f6f4315c8 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E440:1826AA:A71D49:DEE3AE:6A51A29B |
| html-safe-nonce | e8e7b16810ad8a5f91f9a0c0b9a76d9ede4a8a916fa704d0fd0a6d4e787a389c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDQwOjE4MjZBQTpBNzFENDk6REVFM0FFOjZBNTFBMjlCIiwidmlzaXRvcl9pZCI6IjE4ODIwODQxMzQzNjY1ODU0OTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b706b30febc40c868091a5016f97514fc54a72d3212e6ca2d4d155090d313002 |
| hovercard-subject-tag | pull_request:388392806 |
| 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/16773/files |
| twitter:image | https://avatars.githubusercontent.com/u/23121882?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/23121882?s=400&v=4 |
| og:image:alt | PR Summary This PR allows markers to be non-normalized or transformed: MarkerStyle now gets a normalize_path argument, which defaults to True, but can be set False to allow for custom paths that a... |
| 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 | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width