注意
转到结尾下载完整的示例代码。
轴标签位置#
在调用 set_xlabel
和 set_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()
