Black Lives Matter. Please consider donating to Black Girls Code today.

Can't Update 3D surface plot with restyle

So Im plotting a surface plot in plotly.js as
var z = [[1,2,3],[2,3,4],[3,4,5]]
var x = [[1,2,3],[1,2,3],[1,2,3]]
var y = [[10,10,10],[11,11,11],[12,12,12]]
var pl_data=[
{
type: ‘surface’,
“z”: z,
“x”: x,
“y” : y}
];
Potly.newPlot(figurecontainer, pl_data , layout);

This plots the plot but , then If I do this

var zz= [[27.80985,49.61936,83.08067],[27.71966,48.55022,65.21374],[30.4267,33.47752,44.80953]]
 Plotly.restyle(figurecontainer,  {"z": zz} )

The plot doesn’t update. How to fix this?

You’ll need to wrap that update 2d array in another [] to get this to work.

var zz= [[27.80985,49.61936,83.08067],[27.71966,48.55022,65.21374],[30.4267,33.47752,44.80953]]
 Plotly.restyle(figurecontainer,  {"z": [zz]} )

See https://plot.ly/javascript/plotlyjs-function-reference/#plotlyrestyle for more info on restyle.