Title: [MNT]: Move norms to from colors.py to separate file norms.py · Issue #28690 · matplotlib/matplotlib · GitHub
Open Graph Title: [MNT]: Move norms to from colors.py to separate file norms.py · Issue #28690 · matplotlib/matplotlib
X Title: [MNT]: Move norms to from colors.py to separate file norms.py · Issue #28690 · matplotlib/matplotlib
Description: Summary Currently the data→norm→color pipeline involves two files: colors.py: Utility functions for working with colors Colormap and subclasses of Colormap Normalize and subclasses of Normalize cm.py: The colormap registry ScalarMappable...
Open Graph Description: Summary Currently the data→norm→color pipeline involves two files: colors.py: Utility functions for working with colors Colormap and subclasses of Colormap Normalize and subclasses of Normalize cm....
X Description: Summary Currently the data→norm→color pipeline involves two files: colors.py: Utility functions for working with colors Colormap and subclasses of Colormap Normalize and subclasses of Normalize cm....
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/28690
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[MNT]: Move norms to from colors.py to separate file norms.py","articleBody":"### Summary\r\n\r\nCurrently the data→norm→color pipeline involves two files:\r\n1. `colors.py`:\r\n 1. Utility functions for working with colors\r\n 2. `Colormap` and subclasses of `Colormap` \r\n 3. `Normalize` and subclasses of `Normalize`\r\n2. `cm.py`:\r\n 1. The colormap registry\r\n 2. `ScalarMappable` (holds data, norm and colormap)\r\n\r\nIn this structure, each file contains multiple parts of the pipeline, and it is not intuitive which part of the pipeline is located where.\r\n\r\nWith PR #28658 we are creating `colorizer.py` and the new `Colorizer` object to improve the data→norm→color pipeline.\r\nThis has the added benefit that it greatly simplifies `cm.py`, which now only contains the colormap registry (and ScalarMappable for compatibility reasons). \r\n\r\n### Proposed fix\r\n\r\nThis issue suggests moving the norms to a separate file in order to clean up `colors.py`. This, together with #28658 would lead to the following structure:\r\n\r\n1. `colors.py`:\r\n 1. Utility functions for working with colors\r\n 2. `Colormap` and subclasses of `Colormap` \r\n2. `norms.py`\r\n 1. `Normalize` and subclasses of `Normalize`\r\n2. `cm.py`:\r\n 1. The colormap registry\r\n3. `colorizer.py`\r\n 1. `Colorizer` (handles the data→norm→color pipeline)\r\n\r\nWith this structure, each file only contains a single part of the pipeline. \r\n\r\nThis issue came up because I was looking to implement multivariate color mapping (see issue #14168, and PRs #28454, #28658, [#28428]) , and for this we will need at least one more norm (i.e. `MultiNorm`). ","author":{"url":"https://github.com/trygvrad","@type":"Person","name":"trygvrad"},"datePublished":"2024-08-09T08:20:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":18},"url":"https://github.com/28690/matplotlib/issues/28690"}
| 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:f687bb93-604c-afa4-68a2-768963cd3b27 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B21C:9B27A:13C63B:1A11BD:6A5162E3 |
| html-safe-nonce | 65b6d3c48346cc4fcc5363c412d36bc5d80cef77ea7133ad8fcecb514f30ed2a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMjFDOjlCMjdBOjEzQzYzQjoxQTExQkQ6NkE1MTYyRTMiLCJ2aXNpdG9yX2lkIjoiMjUzMDMxNzcyMzI0OTc5NDI3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f531cf32984b7d9bf148585191a56453caca37dde05a5f27abf4a02404cbca47 |
| hovercard-subject-tag | issue:2457384147 |
| 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/28690/issue_layout |
| twitter:image | https://opengraph.githubassets.com/afdf016d40d0b75a4ef31beceb80df3deae05db509926aa0df6393aad4e81d28/matplotlib/matplotlib/issues/28690 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/afdf016d40d0b75a4ef31beceb80df3deae05db509926aa0df6393aad4e81d28/matplotlib/matplotlib/issues/28690 |
| og:image:alt | Summary Currently the data→norm→color pipeline involves two files: colors.py: Utility functions for working with colors Colormap and subclasses of Colormap Normalize and subclasses of Normalize cm.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | trygvrad |
| 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 | 2eeb434949a926fad21064b4d395a54759f7a0b2 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width