matplotlib-StrMethodFormatter

414 阅读1分钟

生成formatter对象,值域需要用x指定,位置域用pos指定(没搞懂)

formatter = matplotlib.ticker.StrMethodFormatter('{x:1.1f}')
axs.xaxis.set_major_formatter(formatter)


使用方法同str.format()。