I would like to make a 3D plot in matplotlib. I have 6 points with x, y and z coordinates. I plotted them and I got this:
But my target is plot where surface between blue lines will be colour-filled.
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
plt.rcParams['svg.fonttype'] = 'none' # during export plots as .svg files, text is exported as text (default text is exported as curves)
data = np.loadtxt('D:\PyCharm\File1.txt', skiprows=1)
x = data[:, 0]
y = data[:, 1]
z = data[:, 2]
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot(x, y, z)
axes = plt.gca()
axes.set_xlim(5712000, 5716000)
axes.set_ylim(5576000, 5579000)
axes.set_zlim(-1000, -600)
axes.set_xlabel('X')
axes.set_ylabel('Y')
axes.set_zlabel('Z')
plt.tight_layout()
plt.show()
And I tried tri-surface plot:
ax.plot_trisurf(x, y, z)
But the shape is not correct:
Edit: About my data: it's text file, which looks like:
X Y Z
5714397 5576607 -1008
5713159 5577871 -999
5713465 5577909 -1014
5714156 5577428 -1022
5714410 5577789 -1035
5715057 5577407 -1036
5714397 5576607 -1008
Second and last rows are the same, but I tried with another file, in which I deleted last row. Plots were the same as above.