Skip to content

Adjusting heatmap colors in Python, Jupyter Lab #1365

@cjhutto

Description

@cjhutto

Hey Nicolas - great resource here, thanks! I've been using PivotTableJS in Jupyter Lab recently, and was attempting to customize the heatmap color scale. Below is what I've tried, but it doesn't quite work... I'm probably missing something simple here, but don't see what it might be.

Can you help?

Here is the Python code I'm running in Jupyter Lab:

pivot_ui(df, 
         rows=["Row1"],
         cols=["Col1", "Col2", "Col3"],
         aggregatorName="Average",
         vals=["Score"],
         rendererName="Heatmap",
         rendererOptions={"heatmap": {
            "colorScaleGenerator": """function(values) {
                return Plotly.d3.scale.linear()
                    .domain([0.0, 0.5, 0.75])
                    .range(["#77F", "#FFF", "#F77"])
            }
         """}
         }
        )

Any help is much appreciated.
Cheers!

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