以下代码用于设置横坐标轴刻度格式现在我要为format_sec函数增加一个参数tick默认为1000请帮我修改一下sec_formatter = tickerFuncFormatterformat_secdef format_secx pos=None return 1fsformatx1000sec_formatter = tickerFuncFormatterformat_sec#请修改
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/cvCy 著作权归作者所有。请勿转载和采集!