【发布时间】:2017-01-25 02:56:32
【问题描述】:
我正在使用 pandas 绘图工具来绘制条形图:
spy_price_data.iloc[40:,1].plot(kind='bar')
条形数据绘制正确,但图中包含奇怪的伪影,以实际图形下方的附加水平条的形式出现:
这可能是什么问题?
【问题讨论】:
-
以下命令的输出是什么:
print(spy_price_data.shape)和print(spy_price_data.index.dtype)? -
那些大概是刻度标签,因为太多了,所以模糊不清。
-
print(spy_price_data.shape)-> (390, 8) , print(spy_price_data.index.dtype)->datetime64[ns]
-
这些可能是刻度标签。令人惊讶的是,当我在与线图 (plot()) 相同的日期时间 x 轴上绘制同一数据框的其他列时,刻度标签会自动调整,以便仅显示每小时刻度。为什么两种绘图类型在同一个 x 轴上表现如此不同?
标签: python pandas matplotlib bar-chart