I'm trying to plot a surface plot of a function by generating the points myself via a for loop. The graph however doesn't show up. I've read that the z entry in the data variable for surface plots has to be an array of arrays but even that hasn't made the plot show up.
var zPts = [];
var xPts = [];
var yPts = [];
for(x=0; x<1; x+=0.01) {
for (y=0; y<1; y+=0.01) {
zPts.push([Math.sin(x*y)]);
yPts.push(y);
xPts.push(x);
}
}
var data = [{
z: zPts,
x: xPts,
y: yPts,
type: 'surface'
}];
var layout = {
title: 'My Plot',
autosize: false,
width: 500,
height: 500,
margin: {
l: 65,
r: 50,
b: 65,
t: 90,
}
};
Plotly.newPlot('theDiv', data, layout);
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<div id="theDiv"></div>