What is the correct data format for plotly 3D surface inputs?
<p>the z3 vector data is produced by prediction from a linear model of x and y so the 3D plot should be a plane.  I supplied 4 points from the "corners" of the data ranges for x and y</p>

<p>plotly will only accept a matrix for the z dimension, so I tried a 2X2 for four data points</p>

<pre><code>x3 &lt;- c(25,25,50,50)
y3 &lt;- c(10,80,10,80)
z3[1,1] &lt;- 1030
z3[1,2] &lt;- 1028 
z3[2,1] &lt;- 791
z3[2,2] &lt;- 903
</code></pre>

<h1>plot the plane</h1>

<pre><code>plot_ly(x=x3,y=y3,z=z3)%&gt;% add_surface()  
</code></pre>

<p>I get 2 points with x=25, y=80 and 2 with x=25, y=10 but none with x[3:4] or y[3:4] </p>

<p>the attached plot has another layer of points but I did not think adding all that code and data would help.</p>

<p>3D surface plot with incorrect plane rendering:
<img src="https://i.stack.imgur.com/po2gQ.jpg" alt="img"></p>

<p>How do I decide what dimensions the z data matrix should have based on the number of points I want to plot and the length of the x and y vectors?</p>