When creating bar graphs and line graphs using matplotlib via pandas I've come across some inconsistent behaviour. For example:
import matplotlib.pyplot as plt
import pandas as pd
from pandas_datareader import data
test_df = data.get_data_yahoo('AAPL', start='2015-10-01')
test_df['Adj Close'].plot()
Plots as expected with sensible x axis labels:
However if you then try to plot something from the same dataframe as a bar graph:
test_df['Volume'].plot(kind='bar')
The x axis tick labels are no longer automatically sensible.
Is this intended behaviour of pandas/matplotlib? And how can one easily rectify the x axis tick labels on bar graphs to be similar to the one in the line graph above?