Using the following code grid doesn't appear properly as it can be seen in the figure that the squares in the xy plane have large size as compared to z axis. how can I get the grid of equal boxes? I have observed the grid squares are equal when I don't apply x and yticks. Can I fix this error?
fig = plt.figure()
ax = fig.add_subplot(111)
x= np.linspace(-math.pi,math.pi,30)
y= np.linspace(-math.pi,math.pi,30)
xx,yy = np.meshgrid(x,y)
X_grid, Y_grid = np.meshgrid(x,y)
print("X_grid shape: ",X_grid.shape)
zz =-2*(np.cos(xx) + np.cos(yy))
ax = plt.axes(projection='3d')
ax.plot_surface(xx,yy,zz)
plt.xticks([x[0],x[int(len(s)/2)], x[-1]], [r'$-\pi$', r'$0$', r'$-\pi$' ])
plt.yticks([y[0],y[int(len(s)/2)], y[-1]], [r'$-\pi$', r'$0$', r'$-\pi$' ])
plt.xlabel("kx")
plt.ylabel("ky")

Referring to the documentation I found this:
See this for .set_zticks. Note that since this is 3D plot so this documentation is found in
mplot3dSo modified the code accordingly.