Skip to content

How to set up classes to match my scale? #385

@alaws-USGS

Description

@alaws-USGS

I am trying to generate a color scale to match the following image:

Image

I have the colors used for each but I have been unable to get the correct classes to return the proper color.

Does my number of classes need to be the # of scale values + 1?
Are class breaks inclusive of the class below or above? Ie if I want values of less than or equal to 5 to be blue, should I set the class break to 5.0001?

My variations

// # of classes = # of scales + 1
const scale = chroma.scale(["#CEBDA1", "#B5A378", "#9C8A50", "#837028", "#6A5700"]).classes([0, 0.001, 0.01, 0.1, 1, 10]);

// Shifting classes to the left but still 1 more class than scale (100 was chosen as it would be outside of range)
const scale = chroma.scale(["#CEBDA1", "#B5A378", "#9C8A50", "#837028", "#6A5700"]).classes([0.001, 0.01, 0.1, 1, 10, 100]);

// # of classes = # of scales
const scale = chroma.scale(["#CEBDA1", "#B5A378", "#9C8A50", "#837028", "#6A5700"]).classes([0.001, 0.01, 0.1, 1, 10]);

Any guidance you can give would be most welcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions