Skip to content

Plotly heatmaps ignore lowercase color_scale names: the default viridis renders as Reds #100

Closed

Description

@jvdd

Problem

The Plotly adapter sends display.color_scale to Plotly as it is. Plotly.js (3.0.0) knows only its own built-in names, with a capital letter: Blackbody, Bluered, Blues, Cividis, Earth, Electric, Greens, Greys, Hot, Jet, Picnic, Portland, Rainbow, RdBu, Reds, Viridis, YlGnBu, YlOrRd.

The FlexViz names are lowercase: the defaults are "viridis" (Histogram2D, GeoHistogram2D, CorrHeatmap with absolute=True) and "rdbu" (CorrHeatmap). The examples in Architecture.md use "plasma". For a name that it does not know, Plotly silently uses its automatic scale: Reds for positive values, and a blue-red diverging scale for data that spans 0.

So a default heatmap of counts renders in Reds, not in viridis. The signed corr_heatmap default ("rdbu") only looks right because the automatic diverging scale is similar. "plasma", "magma" and "inferno" do not exist in Plotly at all. The ECharts adapter maps the lowercase names to local color arrays, so there they work.

Reachability

Every add_histogram2d, add_geo_histogram2d and add_corr_heatmap with the default color_scale. Reproduced on main (f0b8e7c) through gd._fullData[0].colorscale in Chromium:

color_scale Plotly draws
None (default "viridis") Reds (rgb(220,220,220) to rgb(178,10,28))
"Viridis" viridis (#440154 to #fde725)
"plasma" Reds
"rdbu" Reds

Fix

Choose one vocabulary for color_scale and make the Plotly adapter resolve it:

  • Resolve a name without regard to case against the Plotly built-in names, and send the Plotly spelling.
  • Decide what to do with plasma, magma and inferno: send a color array for each, or drop them from the documented names.
  • Reject an unknown name when the spec is built (and see the decoded-spec validation issue), not silently in the browser.

Regression test

A browser test that reads gd._fullData[0].colorscale for the default Histogram2D and checks the first and last colors of viridis.

Activity

  1. added
    bug
    on Sep 27, 2026
  2. jvdd commented on Sep 29, 2026

    @jvdd
    ContributorAuthor

    Fixed by #111.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions