Skip to content

colormap generalization #18809

Closed as not planned
Closed as not planned
@rwijtvliet

Description

@rwijtvliet

Problem

The current implementation of colormaps maps a 1D float interval onto a 1D color spectrum. Meaning, I can use a colormap to find the color that 'matches' a single float value.

Sometimes, however, I'd like to get the color that matches a pair or triplet of float values.

A use case: coloring locations on a city map, where the color for each location is calculated from 2 values: the time needed to get there by car, and the time needed to get there by public transport. Or, from 3 values, if the time needed to get there by bike is also included. In that case, the color could be picked from a color triangle like this one.

Proposed Solution

I ran into this problem and created a solution here: https://github.com/rwijtvliet/interpol.

Now, please note I've only created this for myself and probably needs a lot of work to be able to get merged into matplotlib. For example, there is no unit tests whatsoever.

Proposed Way Forward

  1. A core developer has a look a the linked project to check out, what I mean, and to judge if this is something the matplotlib package would actually benefit from including. (The examples at the ends of the sections ColorMap2 and ColorMap3 in the readme are the best places to start to get an idea of what I mean.)
  2. If yes, someone probably has some suggestions regarding how to start on a PR for this feature. I'd gladly help to get this included into the project, but my coding skills are insufficient to do this without by myself.

But let's first see if this is deemed of interest. :)

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