Home > Enterprise >  I can't plot a 3D contour map
I can't plot a 3D contour map

Time:08-21

this is my dataset

Latitude    Longitude   Elevation
25.519850   88.991217   89.0
25.519850   88.991217   89.0
25.521900   88.998983   94.0
25.521900   88.998983   94.0
25.544183   89.036583   82.0
25.550033   89.048633   100.0
25.558467   89.055300   115.0
25.562500   89.056967   136.0
25.568017   89.056350   126.0
25.571767   89.058683   95.0

This is my written code

from mpl_toolkits import mplot3d

fig = plt.figure()
ax = plt.axes(projection='3d')
ax.contour3D(df['Latitude'], df['Longitude'], df['Elevation'], 50, cmap='binary')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
ax.set_title('3D contour')
plt.show()

But this is showing an error and i cant fix it!

TypeError: Input z must be 2D, not 1D

How can i fix the problem, please help! I want a map like this, enter image description here

  • Related