Skip to content

[MNT]: Move norms to from colors.py to separate file norms.py #28690

Open
@trygvrad

Description

@trygvrad

Summary

Currently the data→norm→color pipeline involves two files:

  1. colors.py:
    1. Utility functions for working with colors
    2. Colormap and subclasses of Colormap
    3. Normalize and subclasses of Normalize
  2. cm.py:
    1. The colormap registry
    2. ScalarMappable (holds data, norm and colormap)

In this structure, each file contains multiple parts of the pipeline, and it is not intuitive which part of the pipeline is located where.

With PR #28658 we are creating colorizer.py and the new Colorizer object to improve the data→norm→color pipeline.
This has the added benefit that it greatly simplifies cm.py, which now only contains the colormap registry (and ScalarMappable for compatibility reasons).

Proposed fix

This 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:

  1. colors.py:
    1. Utility functions for working with colors
    2. Colormap and subclasses of Colormap
  2. norms.py
    1. Normalize and subclasses of Normalize
  3. cm.py:
    1. The colormap registry
  4. colorizer.py
    1. Colorizer (handles the data→norm→color pipeline)

With this structure, each file only contains a single part of the pipeline.

This 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).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions