Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我希望颜色栏中的刻度标签字体与绘图的其余部分不同。我该怎么做?
假设您正在谈论 matplotlib,遍历所有刻度标签并设置字体系列:
import numpy as np import matplotlib.pyplot as plt plt.imshow(np.random.random((10,10))) cb = plt.colorbar() for l in cb.ax.yaxis.get_ticklabels(): l.set_family("Comic Sans MS") plt.show()