# plotting time series data using matplotlib python

I am trying to visualize Time series data is as follows

following is my code to plot the data

plt.plot(data['date'], data['c_16_avg_a'])

plt.xticks(rotation='vertical')

the date is getting truncated here. and the plot looks wired.

Any suggestions will greatly be appreciated

• Are your values sorted by the date (increasing)? If not matplotlib will simply go in the order the values are provided (i.e. go forwards and backwards) in time. – Oxbowerce Jan 27 at 8:36

The best option however, is to add the timestamps as the dataframe's index and use pd.Series.plot() instead of matplotlib.
data.index = data['time_stamp']