question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to configure the `domain` of color in a heatmap at top level

See original GitHub issue

Hi,

I have constructed a heatmap chart with numerical data and now I would like to control the heatmap color domain at the top level. The Chart.configure_range() seems to be a possible way but so far I haven’t figured out how it can work. However, I do notice that in the vega-lite spec, I can easily change the domain to say, from 0 to 10000 like this:

...
"scales": [
...
   {
      "name": "color",
      "type": "sequential",
      "domain": [0,10000],
      "range": {"scheme": "redyellowblue"},
      "zero": false,
      "reverse": true
    }
],
...

My question is, is there an equivalent way to do the same thing with a constructed Chart instance? Thanks.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
jakevdpcommented, Jan 23, 2019

Yes, every Vega-Lite command maps directly to an Altair command. The snippet above appears to be part of a Vega spec rather than vega-lite spec, though, so there is no altair equivalent.

The way you can control scales within Altair/Vega-Lite is via the scale property of the encoding; for example:

alt.Chart(data).encode(
    color=alt.Color('color:Q', scale=alt.Scale(domain=[0, 10000]))
)
0reactions
xujiboycommented, Jan 25, 2019

This is great reference. Thank you very much Jake.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Complete Guide to Heatmaps | Tutorial by Chartio
Choose an appropriate color palette · Include a legend · Show values in cells · Sort levels by similarity or value · Select...
Read more >
Heatmap dc.js - provide the color range manually
I received a _colors.domain is not a function error. When I remove the .calculateColorDomain(), the heatmap display all black boxes. My goal is ......
Read more >
Heat Map Configuration Options Workspace - VMware Docs
Group by, First-level grouping of the objects in the heat map. ... You can set each color and type minimum and maximum color...
Read more >
Build a Highlight Table or Heat Map - Tableau Help
Hover over the SUM(Profit) color legend, then click the drop-down arrow that appears and select Edit Colors. In the Edit Colors dialog box,...
Read more >
heatmapRenderer | Web Map Specification - ArcGIS Developers
maxDensity, The density value assigned to the final color in the colorStops . Only used for heatmaps calculated with kernel density. This value...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found