I am using following code to plot a surface
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import LinearLocator
import numpy as np
fig = plt.figure()
ax = fig.gca(projection='3d')
# Make data.
X = np.arange(-5, 5, 0.25)
xlen = len(X)
Y = np.arange(-5, 5, 0.25)
ylen = len(Y)
X, Y = np.meshgrid(X, Y)
R = np.sqrt(X**2 + Y**2)
Z = np.sin(R)
# Create an empty array of strings with the same shape as the meshgrid, and
# populate it with two colors in a checkerboard pattern.
colortuple = ('y', 'b')
colors = np.empty(X.shape, dtype=str)
for y in range(ylen):
for x in range(xlen):
colors[x, y] = colortuple[(x + y) % len(colortuple)]
# Plot the surface with face colors taken from the array we made.
surf = ax.plot_surface(X, Y, Z, facecolors=colors, linewidth=0)
# Customize the z axis.
ax.set_zlim(-1, 1)
ax.w_zaxis.set_major_locator(LinearLocator(6))
plt.show()
Now I have three variables in List Form.
X = [-0.105625455, -0.174359608, -0.105873346, -0.20576805399999998, -0.120525806, -0.28215594, -0.093060075, -0.14982578900000001, -0.119486435, -0.151960108, -0.10104339999999999, -0.23913942, -0.106686264, -0.16127649300000002]
Y = [0.177165099, -0.029949987, 0.145072897, -0.038238821, 0.157384682, -0.035901472000000004, 0.138161626, -0.037059772000000005, 0.151773712, -0.04529447, 0.14621367300000002, -0.036671638, 0.16619656800000002, -0.032974679]
Z = [0.166806127, 0.20898661899999998, 0.187877354, 0.226367115, 0.18765406699999998, 0.22494885899999997, 0.19316028699999999, 0.212110438, 0.204398195, 0.22953668100000002, 0.205943133, 0.231321515, 0.194322528, 0.246532118]
I want to plot these on some beautiful 3D surface. In MATLAB I just used 3 lines to plot and it all plotted beautifully.
Can someone guide me how to plot this beautifully on a 3D surface with cubic Interpolation I tried to replace my variables with this and converted all Variables to ndarray and then took a mesh grid but still did not work?