Black Lives Matter. Please consider donating to Black Girls Code today.
Dash Enterprise delivers an incredible 21x cost savings 💸Download the e-book!

Streaming heatmap


I would like to ask how can i stream the z axis of a heatmap using a function for the update.
I suppose i should use the extendTraces. But since the z axis is a two dimensional array, I am a little confused of what the function should return.
Is there an example of a heatmap streaming the z axis?

Thanks in advance,

see ColorScale is not updating when we use extendTraces

Etienne thanks for the response!
I would like to have a function updating the z value.

so, instead of:
return Plotly.extendTraces(gd, {
z: [[[10, 20, 30]]]
}, [0])

something like:
function rand() {
return Math.random();
return Plotly.extendTraces(gd, {
z: [[[rand()]]]
}, [0])
But this is not working. What is the correct way to do it?

extendTraces wasn’t designed to update z value(s).


Plotly.restyle(gd, {
  z: [[[rand()]]]
}, [0])