Skip to content

Ordinal opacity scales #2284

Open
Open
@mbostock

Description

@mbostock
Member

We support ordinal color scales:

Image
Plot.legend({color: {type: "ordinal", domain: d3.range(10)}})

But trying to do the same with an opacity scale results in an error:

Error: ordinal opacity scales are not supported
Plot.legend({opacity: {type: "ordinal", domain: d3.range(10)}})

I see no reason we couldn’t support ordinal opacity scales by dividing the range interval [0, 1] equally based on the cardinality of the domain.

Image

Activity

linked a pull request that will close this issue on Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @mbostock

      Issue actions

        Ordinal opacity scales · Issue #2284 · observablehq/plot