0
私はDateTimeインデックスを持つpandas DataFrameを持っています。matplotlibのx軸日時ラベルの争い
私はそれからtimeseriesをプロットすることができ、デフォルトでは正常に見えます。
しかし、同じDataFrameから棒グラフを印刷しようとすると、xAxisのラベルが壊れてしまいます(大規模なオーバーラップ)。 (また、データの間隔が
)のバーのセットの間に奇妙な(大きなギャップである私はautoformat_xdate()
を試してみましたが、それは何も助けにはならなかった。
これは私が使用する単純なコード断片でありますグラフを生成する
entire_df['predict'] = regr.predict(entire_df[X_cols])
entire_df['error'] = entire_df['predict']-entire_df['px_usd_mmbtu']
#entire_df['error'].plot(kind='hist')
fig=plt.figure()
entire_df[['px_usd_mmbtu', 'predict']].plot()
fig2 = plt.figure()
entire_df['error'].plot(kind='bar')
#fig2.autofmt_xdate() #doesn't help
print (type(error_df.index))