我正在尝试将股票价格与时间绘制在一起(如上所示)。下面的代码确实绘制了“OPEN”价格,但当我尝试将X轴日期从序数格式转换为ISO日期格式时,它会抛出AttributeError
。
相同的代码在绘制OHLC图时有效,但现在不起作用。
AttributeError: 'list' object has no attribute 'xaxis'
df_copy = read_stock('EBAY')
fig = plt.figure(figsize= (12,10), dpi = 80)
ax1 = plt.subplot(111)
ax1 = plt.plot(df_copy['Date'], df_copy['Open'], label = 'Open values' )
ax1.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d'))
df_copy.set_index('Date').Open.plot(label='Open values')
。 - cs95