Skip to content
This repository was archived by the owner on Mar 14, 2026. It is now read-only.
This repository was archived by the owner on Mar 14, 2026. It is now read-only.

Expose continuous analogues of colormaps #69

Description

@jwmerrill

It's currently easy to get a beautiful red-blue diverging colormap with, e.g. 20 colors by calling

colormap("RdBu", 20)

I would like to be able to map a continuous variable (for definiteness, say it ranges from -1.0 to 1.0) into this map, but I don't currently see an easy way to do this. Basically what I'm asking for is the N → ∞ limit of

function (x)
    colormap("RdBu", N)[1 + ifloor((x + 1.0)/2.0*N)]
end

I haven't gotten completely to the bottom of the way things are currently implemented, but given that you can already specify different values for N, it seems like something close to such a function must already exist privately somewhere inside the implementation, and it would be nice to expose it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions