-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
template.layout.colorscale not applied to heatmap unless autocolorscale is True #3829
Comments
Related #3100 The problem here isn't with templates, it's how So, one could argue that whenever Plotly.newPlot('graph', [{
type: 'heatmap',
z: [[-1,2,3], [2,1,4]],
}], {
colorscale: {
sequential: 'Viridis'
}
}) here the colorscale is diverging, meaning that the set I'd be ok in making |
I don't mind setting var fig = {
"data": [
{
"type": "heatmap",
"x": [1, 2, 3, 4, 5, 6, 7, 8, 9],
"y": [1, 2, 3, 4, 5, 6, 7, 8, 9],
"z": [1, 2, 3, 4, 5, 6, 7, 8, 9],
"colorscale": "Viridis"
}
],
"layout": {
"template": {
"data": {
"heatmap": [
{"autocolorscale": true}
]
},
"layout": {
"colorscale": {
"sequential": "Cividis"
}
}
},
"title": {
"text": "Colorscale templating test"
}
}
}
Plotly.newPlot('myDiv', fig, {showSendToCloud: true}); Would you consider this to be a bug? |
I wouldn't call this a bug, as your var fig = {
"data": [
{
"type": "heatmap",
"x": [1, 2, 3, 4, 5, 6, 7, 8, 9],
"y": [1, 2, 3, 4, 5, 6, 7, 8, 9],
"z": [1, 2, 3, 4, 5, 6, 7, 8, 9],
"autocolorscale": true,
"colorscale": "Viridis"
}
],
"layout": {
"colorscale": {
"sequential": "Cividis"
},
"title": {
"text": "Colorscale templating test"
}
}
}
Plotly.newPlot('graph', fig, {showSendToCloud: true}); which (and should) renders the heatmap with Now, note that: var fig = {
"data": [
{
"type": "heatmap",
"x": [1, 2, 3, 4, 5, 6, 7, 8, 9],
"y": [1, 2, 3, 4, 5, 6, 7, 8, 9],
"z": [1, 2, 3, 4, 5, 6, 7, 8, 9],
// "colorscale": "Viridis"
}
],
"layout": {
"template": {
"data": {
"heatmap": [
{"autocolorscale": true}
]
},
"layout": {
"colorscale": {
"sequential": "Cividis"
}
}
},
"title": {
"text": "Colorscale templating test"
}
}
}
Plotly.newPlot(gd, fig)
Plotly.restyle(gd, 'colorscale', 'Viridis') renders the heatmap with |
Ok, I think I understand now. I was missing the fact that Thanks for working through it with me. I think I have the knowledge I need now 🙂 |
No worries @jonmmease ! I'm very much looking forward to making |
Consider a heatmap trace with a template that specifies a global default colorscale:
CodePen: https://codepen.io/jonmmease/pen/XQvbge?editors=1010
This template colorscale is not applied. If the template's heatmap
autocolorscale
property is set totrue
then the colorscale is applied.but in this case, the colorscale provided in the
heatmap
trace is ignored.I don't fully understand the intended behavior of
autocolorscale
in the case of templates, but I think we need some way to specify a default global colorscale in the template and then be able to override it in the trace without explicitly specifyingautocolorscale
in the trace.What do you think?
The text was updated successfully, but these errors were encountered: