-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
Consider a heatmap trace with a template that specifies a global default colorscale:
CodePen: https://codepen.io/jonmmease/pen/XQvbge?editors=1010
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],
}
],
"layout": {
"template": {
"layout": {
"colorscale": {
"sequential": "Cividis"
}
}
},
"title": {
"text": "Colorscale templating test"
}
}
}
Plotly.newPlot('myDiv', fig, {showSendToCloud: true});
This template colorscale is not applied. If the template's heatmap autocolorscale
property is set to true
then the colorscale is applied.
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});
but in this case, the colorscale provided in the heatmap
trace is ignored.
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});
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 specifying autocolorscale
in the trace.
What do you think?
Metadata
Metadata
Assignees
Labels
No labels