pyplot轴中日期时间的格式

pyplot轴中日期时间的格式,第1张

pyplot轴中日期时间格式

您可以使用

DateFormatter

fig = plt.figure()ax = fig.add_subplot(111)ax.plot(your_dates, your_data)# format your data to desired format. Here I chose YYYY-MM-DD but you can set it to whatever you want.import matplotlib.dates as mdatesax.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d'))# rotate and align the tick labels so they look betterfig.autofmt_xdate()


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5616862.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-15
下一篇2022-12-15

发表评论

登录后才能评论

评论列表(0条)

    保存