0
我從matplotlib網站複製此示例,現在我想更改標籤的字體,顏色和大小,但不更改數字大小。並且有可能只看到中間和每邊結尾的數字?設置圖表的標籤
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.gca(projection='3d')
X, Y = np.mgrid[0:6*np.pi:0.25, 0:4*np.pi:0.25]
Z = np.sqrt(np.abs(np.cos(X) + np.cos(Y)))
surf = ax.plot_surface(X + 1e5, Y + 1e5, Z, cmap='autumn', cstride=2, rstride=2)
ax.set_xlabel("X-Label")
ax.set_ylabel("Y-Label")
ax.set_zlabel("Z-Label")
ax.set_zlim(0, 2)
plt.show()
謝謝
一般來說,最好使用定位器,而不是手動設置刻度位置。 – tacaswell
什麼是定位器?我沒有用過。我怎麼能只考慮中間和頂部的價值?對於軸上沒有很多麻煩。 –
http://matplotlib.org/api/ticker_api.html#tick-locating'ax.get_yaxis()。get_major_locator()。set_params(nbins = 3)'會給你三個滴答聲。 (編輯,拼寫) – tacaswell