Datetime UTC毫秒格式的matplotlib日期格式

Datetime UTC毫秒格式的matplotlib日期格式,datetime,matplotlib,datetime-format,Datetime,Matplotlib,Datetime Format,我有外汇货币的报价数据,我正试图使用matplotlib绘制这些数据 我可以绘制数据,但x轴上的日期以毫秒为单位,没有帮助 我已成功地将日期转换为日期时间格式,但结果如下: datetime.datetime(2015, 12, 12, 2, 0) 当我尝试运行代码时,出现以下错误: line 804, in _candlestick xy=(t - OFFSET, lower), TypeError: unsupported operand type(s) for -: 'datetime.

我有外汇货币的报价数据,我正试图使用matplotlib绘制这些数据

我可以绘制数据,但x轴上的日期以毫秒为单位,没有帮助

我已成功地将日期转换为日期时间格式,但结果如下:

datetime.datetime(2015, 12, 12, 2, 0)
当我尝试运行代码时,出现以下错误:

line 804, in _candlestick
xy=(t - OFFSET, lower),
TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'float'

Process finished with exit code 1
我的代码基本如下:

quotes = [dates, open, highest, low, close, volume]

ax = plt.subplot2grid((6, 4), (1, 0), rowspan=6, colspan=4, facecolor='#FFFFFF')

ax.xaxis.set_major_formatter(mdates.DateFormatter('%y-%m-%d %H:%M:%S'))

MOCHLV = zip(quotes[0], quotes[1], quotes[2], quotes[3], quotes[4], quotes[5])


matplotlib.finance.candlestick_ohlc(ax, MOCHLV, width=1.9, colorup='#53c156', colordown='#ff1717')

plt.ylabel('BTC/USD')
plt.xlabel('Date Hours:Minutes')
plt.show()

经过一番探索,我在这里找到了答案。经过一番探索,我在这里找到了答案。