軸標籤位置#

在呼叫 set_xlabelset_ylabel 以及色彩條時,選擇軸標籤位置。

import matplotlib.pyplot as plt

fig, ax = plt.subplots()

sc = ax.scatter([1, 2], [1, 2], c=[1, 2])
ax.set_ylabel('YLabel', loc='top')
ax.set_xlabel('XLabel', loc='left')
cbar = fig.colorbar(sc)
cbar.set_label("ZLabel", loc='top')

plt.show()
axis labels demo

標籤:元件:軸 樣式:位置 程度:初學者

由 Sphinx-Gallery 產生圖庫