我已经使用了很长一段时间的小子例程来格式化我正在绘制的图表的轴。举几个例子:
def format_y_label_thousands(): # format y-axis tick labels formats
ax = plt.gca()
label_format = '{:,.0f}'
ax.set_yticklabels([label_format.format(x) for x in ax.get_yticks().tolist()])
def format_y_label_percent(): # format y-axis tick labels formats
ax = plt.gca()
label_format = '{:.1%}'
ax.set_yticklabels([label_format.format(x) for x in ax.get_yticks().tolist()])
然而,昨天更新 matplotlib 后,在调用这两个函数中的任何一个时,我收到以下警告:
UserWarning: FixedFormatter should only be used together with FixedLocator
ax.set_yticklabels([label_format.format(x) for x in ax.get_yticks().tolist()])
出现这样的警告的原因是什么?我无法弄清楚如何查看 matplotlib 的文档。
qq_笑_17
慕无忌1623718
慕雪6442864
慕斯王
相关分类