MAS
MAS

Reputation: 4993

the label of the axis in matplotlib is overwritten by the ticks

How can I change the z axis label position of my figure. this is how my figure looks like. enter image description here

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

Answers (1)

Mathias711
Mathias711

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

Related Questions