【发布时间】:2019-09-15 22:18:09
【问题描述】:
我想绘制一些随季节变化的时间序列,并使用 axvspan 将冬季的部分绘图阴影与夏季的部分阴影不同。我正在使用pyplot.plot_date。我的 y 值是浮点数的 np 数组,我的 x 值是使用转换的日期时间对象的 np 数组
datetime.strptime(date, '%m-%d-%Y').
我想使用pyplot.axvspan 来应用阴影,但它似乎只适用于 x 轴的常规数字,而我的 x 轴是日期。我遇到的错误是
ValueError: view limit minimum -36858.05 is less than 1 and is an invalid Matplotlib date value. This often happens if you pass a non-datetime value to an axis that has datetime units
有什么办法可以解决这个问题?
【问题讨论】:
标签: python date matplotlib time-series