Description
In working on developing templates for plotly.py I've found that I'm not able to set the colorscale and colorbar properties in the template for some trace types.
This works as I expect for the heatmap
trace type. The defualt colorscale of Viridis and the colorbar tick properties are both applied.
Pen: https://codepen.io/jonmmease/pen/mzMeMW
var trace1 = {
type: 'heatmap',
z: [[1, 2, 3], [4, 5, 6]],
};
var data = [ trace1 ];
var layout = {
template: {
data: {
heatmap: [{
colorscale: 'Viridis',
colorbar: {
ticks: 'inside',
ticklen: 10,
tickcolor: 'white'
}
}],
}
}
};
Plotly.newPlot('myDiv', data, layout);
But it does not work for the scatter.marker
colorscale and colorbar.
Pen: https://codepen.io/jonmmease/pen/LgjpQG
var trace1 = {
type: 'scatter',
y: [1, 2, 3],
marker: {
size: 20,
color: [1, 2, 3],
showscale: true
},
mode: 'markers'
};
var data = [ trace1 ];
var layout = {
template: {
data: {
scatter: [{
marker: {
symbol: 'square',
colorscale: 'Viridis',
colorbar: {
ticks: 'inside',
ticklen: 10,
tickcolor: 'white'
}
}
}],
}
}
};
Plotly.newPlot('myDiv', data, layout);
Note that scatter.marker.symbol
is being picked up from the template, so I'm pretty sure the template specification is correct, but let me know if I'm missing something.
I've noticed this same behavior for other colorscales and colorbars, and I can work through an exhaustive list later today if that's helpful. Thanks!