Skip to content

Color maps from function #19258

@Inspirateur

Description

@Inspirateur

Problem

Would be nice if we could just pass a function as a cmap, and matplotlib would just query it to get a color from a value.

example of usage:

from colorsys import hsl_to_rgb
import matplotlib.pyplot as plt

y = ...  # some data for an histogram
cmap = lambda x: hsl_to_rgb(x, .9, .5)**2
plt.hist(y, cmap=cmap)

Proposed Solution

I don't know how realistic this is but I've just never seen it even suggested when googling.
It certainly feels reasonable to me but I can't tell because I don't know much about the implementation.
If this is not feasible at least this would set a record for future google queries...

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy