2016-04-06 80 views
1

如何更改圖形的z軸標籤位置。這就是我的形象。 enter image description herematplotlib中軸的標籤被刻度覆蓋

這是我的代碼:

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') 

回答

2

可以使用labelpad參數:

plt.zlabel(*, labelpad=20) 

,或者你可以事後更改:

ax.zaxis.labelpad = 20 

玩它直到它符合你的需求。