Skip to content

Annotated Heatmap with custom color scale raises ValueError #1122

Closed
@andy-lz

Description

@andy-lz

Creating an annotated heatmap with figure factory using a custom color scale (as seen below) leads to a ValueError: "map object not subscriptable."

import plotly.figure_factory as ff

data_test2 = ff.create_annotated_heatmap(z=z, x=x, y=y, colorscale=[[0.0, 'rgb(250,0,0)'], [0.5, 'rgb(250,250,250)'], [1.0, 'rgb(0,0,0)']], annotation_text=df_str, showscale=True)

I fixed this by explicitly defining the map objects for min_col and max_col in _AnnotatedHeatMap.get_text_color() as lists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions