Is there anyway to plot surface in Python by only having X, Y, Z coordinates?
I have column vectors of X, Y, Z values where Z=F(X,Y) is already calculated ( I only have the data not the function )
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure(figsize = (12,10))
ax = plt.axes(projection='3d')
x = np.arange(-5, 5.1, 0.2)
y = np.arange(-5, 5.1, 0.2)
X, Y = np.meshgrid(x, y)
Z = np.sin(X)*np.cos(Y)
surf = ax.plot_surface(X, Y, Z, cmap = plt.cm.cividis)
# Set axes label
ax.set_xlabel('x', labelpad=20)
ax.set_ylabel('y', labelpad=20)
ax.set_zlabel('z', labelpad=20)
fig.colorbar(surf, shrink=0.5, aspect=8)
plt.show()
Examples like above in the manual consider that you can calculate Z = np.sin(X)*np.cos(Y)
But I cannot do that since I don't have the function.
Is there anyway to plot surface with only having X, Y, Z values in Python?