# How does surface work?

I am trying to use plotly surface to plot a sphere of binned data. I have the centre of each bin in longitude and latitude which I can easily convert to x, y and z. But what I am stuck on is how Surface actually works I am seeing examples where the x, y and z co-ordinates define the edge of the vertex and other examples where there arenβt enough co-ordinates for it to possibly be the edge of each vertex. So what is surface actually doing? is it the centre or the edge? If I was using matplotlib pcolormesh I would be defining the edges of each bin. Basically I need to understand what its doing with x, y and z so I know what to provide it

@08walkersj Depending on how the surface is given, i.e. by its explicit
equation z=f(x,y), (x,y)\in [a,b]\times [c,d] or by a parameterization:
\begin{array}{lll}x&=&x(u,v)\\ y&=&y(u,v), \:\: (u,v)\in[\alpha, \beta]\\ z&=&z(u,v)\\ \end{array}
the data x, y can be lists/vectors in the first case, and z a 2d array,
while in the second case x, y, z must be 2d arrays:
1. Surface z=\sin(x)*\cos(y), x, y \in[-\pi/2, \pi/2]\times[0,2\pi/3]

import plotly.graph_objects as go
import numpy as np
from numpy import pi, sin, cos
x = np.linspace(-pi/2, pi/2, 100)
y = np.linspace(0,2*pi/3, 80)
X, Y = np.meshgrid(x,y)
z = sin(X)*cos(Y)
fig1=go.Figure(go.Surface(x=x, y=y, z=z, colorscale="deep_r",
colorbar_thickness=24))
fig1.update_layout(width=500, height=500, font_size=10,
scene_camera_eye=dict(x=1.55, y=1.55, z=1))
fig1.show()


2: Sphere given through a parameterization:

theta = np.linspace(0, 2*pi, 150)
phi = np.linspace(0, pi, 150)
theta, phi = np.meshgrid(theta, phi)
x = cos(theta)*sin(phi)
y = sin(theta)*sin(phi)
z = cos(phi)
fig2 = go.Figure(go.Surface(x=x, y=y, z=z, colorscale="deep_r",
colorbar_thickness=24, colorbar_len=0.75))
fig2.update_layout(fig1.layout)
fig2.show()