2

I am using the pandas plot facilities, to plot a bar plot:

spy_price_data.iloc[40:,1].plot(kind='bar')

The bar data is plotted correctly, but the figure contains weird artefacts in the form of additional horizontal bars below the actual figure:

bar plot artefacts

What could be the problem here?

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Oblomov
  • 8,953
  • 22
  • 60
  • 106
  • 1
    what is the output of the following commands: `print(spy_price_data.shape)` and `print(spy_price_data.index.dtype)`? – MaxU - stand with Ukraine Sep 16 '16 at 19:37
  • 4
    Those are presumably the tick labels, blurred and unreadable because there are too many of them. – BrenBarn Sep 16 '16 at 19:38
  • print(spy_price_data.shape)-> (390, 8) , print(spy_price_data.index.dtype)->datetime64[ns] – Oblomov Sep 16 '16 at 19:46
  • These are probably the tick labels. Surprisingly, when I plot other columns of the same dataframe over the same datetime x-axis as line plots (plot()) , the tick labels are automatically adjusted such that only hourly ticks are displayed. Why do both plot types behave so differently for the same x-axis? – Oblomov Sep 16 '16 at 19:50

1 Answers1

0

The 'weird artefacts' are your ticklabels. You can even (almost) read them at the end:

enter image description here

The last value seems to say something like 2018-08-19 20:00:00. To make the plot more readable, take a look at the answer from ImportanceOfBeingErnest to the question Matplotlib: How to increase space between tickmarks (or reduce number of tickmarks)?

vestland
  • 55,229
  • 37
  • 187
  • 305