Skip to content

Categorical colorscales #1747

@alanocallaghan

Description

@alanocallaghan

Would it be possible to add the ability to use categorical (ie, String) values in a heatmap, mapped to a color scale?

This is currently possible only by mapping to numeric values and spoofing a colorscale and colorbar.

EG: https://i.stack.imgur.com/1MS66.png

Again apologies, in this case I realise this could require a radical overhaul of that trace

Activity

etpinard

etpinard commented on May 30, 2017

@etpinard
Contributor

Thanks for writing in. More generally, we should start thinking about adding categorical colorscales that could be applied not only to heatmap traces but to scatter bubble charts and choropleths to name a few.

In the meantime, here's a (somewhat hacky) workaround: https://codepen.io/etpinard/pen/GmbVZq?editors=0010

alanocallaghan

alanocallaghan commented on May 30, 2017

@alanocallaghan
Author

Cheers. If you have pointers on where to look I'd be glad to have a try, though my JS is not exactly the greatest

changed the title [-]Categorical heatmaps[/-] [+]Categorical colorscales[/+] on May 30, 2017
talgalili

talgalili commented on May 31, 2017

@talgalili
nicolaskruchten

nicolaskruchten commented on Jun 29, 2018

@nicolaskruchten
Contributor

Let's resurrect this guy :)

As a starting point, I propose a new flag somewhere that says "treat the values in the color array as discrete and generate a categorical colorscale" that way we could pass in either numbers or non-css strings and have a categorical colorscale/colorbar be generated.

nicolaskruchten

nicolaskruchten commented on Oct 11, 2018

@nicolaskruchten
Contributor

Additional thoughts on this from a conversation with @alexcjohnson when he was in Montreal: for categorical colorscales we should could not use the colorbar: we should could instead insert legend items like we do for pie traces.

self-assigned this
on Oct 11, 2018
removed their assignment
on Oct 25, 2018
bearmountainsolutions

bearmountainsolutions commented on Dec 10, 2018

@bearmountainsolutions
nicolaskruchten

nicolaskruchten commented on Apr 4, 2019

@nicolaskruchten
Contributor

@etpinard can you propose something here plz?

talgalili

talgalili commented on Jun 20, 2020

@talgalili

+1

amnfar

amnfar commented on Feb 3, 2023

@amnfar

Do we have a solution now? I have also exhausted all my resources to plot cetagorical values in heatmap. Do we have categorical color scales for heatmaps ?

self-assigned this
on Jun 10, 2024
removed their assignment
on Aug 2, 2024
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

    P3backlogfeaturesomething new

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @nicolaskruchten@gvwilson@talgalili@rmoestl@etpinard

        Issue actions

          Categorical colorscales · Issue #1747 · plotly/plotly.js