【发布时间】:2018-08-22 12:30:36
【问题描述】:
我一直是debugging display issues when making bar charts of pandas dataframes。
今天遇到一个奇怪的问题:
index: <class 'pandas.tseries.index.DatetimeIndex'>
count 83.000
mean 0.000
std 0.879
min -2.159
25% -0.605
50% 0.001
75% 0.658
max 2.254
Name: error, dtype: float64
当我将数据绘制为时间序列时,它看起来很好:
plt.plot(errors.index, errors.values)
但如果我将其打印为条形图,则大多数条形都不会出现:
plt.bar(errors.index, errors.values)
plt.gcf().autofmt_xdate()
我认为条形图的数据条过多,无法很好地显示,但如果我直接从数据框中绘制条形,则情况并非如此:
errors.plot(kind="bar")
但是,dataframe.plot 并不能很好地处理带有轴标签的这么多条...但它告诉我 plt.bar 应该能够显示这个。
【问题讨论】:
-
如果不访问Minimal, Complete, and Verifiable example,则无法重现该问题
标签: pandas matplotlib