Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heatmap to color cells even when all the values are the same #1306

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chutzimir
Copy link

Currently when the table only plots one possible value (e.g., table of
NULL and 1), the cells with a value have no color. I thought this is
counterintuitive, so I tried a custom heatmap using the weather example.
Indeed, using Plotly as below I can get the same heatmap as now, but
when my table only has a single possible value I can still tell the
cells with values from those with no value because they are white.

    rendererOptions: {
        heatmap: {
            colorScaleGenerator: function(values) {
                var min, max;
                min = Math.min.apply(Math, values);
                max = Math.max.apply(Math, values);
                return Plotly.d3.scale.linear()
                    .domain([min, max])
                    .range(["white", "red"])
                ;
            }
        }
    },

Currently when the table only plots one possible value (e.g., table of
NULL and 1), the cells with a value have no color. I thought this is
counterintuitive, so I tried a custom heatmap using the weather example.
Indeed, using Plotly as below I can get the same heatmap as now, but
when my table only has a single possible value I can still tell the
cells with values from those with no value because they are white.

```
    rendererOptions: {
        heatmap: {
            colorScaleGenerator: function(values) {
                var min, max;
                min = Math.min.apply(Math, values);
                max = Math.max.apply(Math, values);
                return Plotly.d3.scale.linear()
                    .domain([min, max])
                    .range(["white", "red"])
                ;
            }
        }
    },

```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant