Issue
Minimum working example:
#Python
import matplotlib.pyplot as plt
x = [0, 1, 2, 3, 4, 5]
y = [0, 1, 2, 3, 4, 5]
z = [0, 1, 2, 3, 4, 5]
fig = plt.figure()
ax = plt.axes(projection="3d")
ax.scatter(x, y, z, c='g', s=20)
plt.xlabel("X data")
plt.ylabel("Y data")
#plt.zlabel("Z data") DOES NOT WORK
ax.view_init(60,35)
plt.show()
Question: how to set up the label of the Z axis? For some reason plt has the xlabel and ylabel properties, but not the zlabel.
Solution
For 3D plots the labels need to be changed using the axes objects.
Try something like this
ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')
Answered By - Iddo Sadeh
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.