Python Matplotlib 横坐标轴刻度格式设置:自定义函数添加参数
def format_sec(x, pos=None, tick=1000): return '{:.1f}s'.format(x/tick)
sec_formatter = ticker.FuncFormatter(lambda x, pos: format_sec(x, pos, tick=1000)) plt.gca().xaxis.set_major_formatter(sec_formatter)
原文地址: https://www.cveoy.top/t/topic/jXFa 著作权归作者所有。请勿转载和采集!