I have multiple plot. I want to set Z lim such that it only shows the curve within the specified range. My code here
# make 3d axes
fig = plt.figure()
ax = fig.gca(projection='3d')
# test data
x = np.arange(-1., 1., .1)
y = np.arange(-1., 1., .1)
z1 = x**2
z2 = x**3
z3 = x**4
# plot test data
ax.plot(x, np.ones(len(x)), z1)
ax.plot(x, np.ones(len(x))*3, z2)
ax.plot(x, np.ones(len(x))*5, z3)
# make labels
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
ax.set_zlim(0)
plt.show()
Shows
I'm expecting that only the positive part of Z2 shown on the graph but it shows all the curves and make the plot messier.