Interpolate a regular mesh for your scattered points: You can use the TriScatteredInterp function to create an interpolant that you can evaluate at a given set of regularly spaced grid points, then plot the interpolated 3-D surface using the function MESH.Trimesh(tri,x,y,z) % Plot the mesh in 3-D Tri = delaunay(x,y) % Create a 2-D triangular mesh Plot a triangular mesh: You can connect your x and y points into a 2-D triangular mesh using the function DELAUNAY, then plot a 3-D mesh using the function TRIMESH:.To plot this surface as a mesh, you have to define some sort of connectivity between them. This is a guess, but it sounds like what you actually have is a set of x, y, and z data that represent 3-D points scattered in space that lie on a surface.
ax.scatter3D () method is used to draw scatter plots in the 3D plane. After this, to get the origin of the 3D scatter plot we use the np.zeros () method. pyplot.scatter (x, y) For a 3D plot, you can try something like this. Then we create a figure by using the figure () method. So you can convert your dates to as number as follows: y (d-min (datesformatted)).days for d in datesformatted Now you can plot the data as. You're replicating the vectors x and y to create a set of matrices X and Y when you use MESHGRID, and since z is still a vector, and not a matrix of the same size as X and Y, you can't plot a mesh. In the above example, we import libraries mplot3d, numpy, and pyplot of matplotlib. Your variable Z is still a column vector, since size(test,2) is 3 and thus the column index 3:size(test,2) is still just 3.