Reputation: 4993
How can I change the z axis label position of my figure. this is how my figure looks like.
This is my code:
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(10,8))
ax = fig.gca(projection='3d') # get current axis
surf = ax.plot_surface(X, Y, Z)
ax.set_xlabel('Intercept')
ax.set_ylabel('Slope')
ax.set_zlabel('Error')
Upvotes: 1
Views: 455
Reputation: 6658
You can use the labelpad parameter:
plt.zlabel(*, labelpad=20)
or you can change it afterwards:
ax.zaxis.labelpad = 20
Play around with it until it fits your needs.
Upvotes: 3