Pandas and Matplotlib can be used to plot various types of graphs. Simple timeseries plot and candlestick are basic graphs used by technical analyst for identifying the trend.

## Simple time Series Chart using Python – pandas matplotlib

Here is the simplest graph. It uses close price of HDFCBANK for last 24 months to plot normal graph

Here is the sample output

## Candlestick chart using Python – pandas matplotlib

As per this link, module matplotlib.finance is deprecated in 2.0 and has been moved to a module called mpl_finance. This is still working when I have motplotlib version 2.1.2. This may stop working in any future releases, however, you can use mpl_finance module to use this feature. Please note that mpl_finance is no longer maintained.

Here is the output

## Candlestick chart with SMA overlay using Python – pandas matplotlib

here is the output

hi, thanks for this post.

if only I knew what was in ’15-06-2016-TO-14-06-2018HDFCBANKALLN.csv’ or how you got it it would be very helpful!

cheers!

Hi aristides,

File is located at below location

https://raw.githubusercontent.com/conquistadorjd/python-03-matplotlib/master/15-06-2016-TO-14-06-2018HDFCBANKALLN.csv

Right click and save it as CVS/XLS and you can see the content.

hi awesome post but matplotlib_finance doesnt work anymore

if Latest matplotlib module does not have finance sub module, you can download mpl_finance module from https://github.com/matplotlib/mpl_finance. You can install it using following command

pip install https://github.com/matplotlib/mpl_finance/archive/master.zip

remaining steps remains the same.

Hi Pravin – Thanks for sharing. It looks wonderful. However – It would tremendously help me if we can have volume overlay at the bottom of the chart…Is that simple enough to do? Any pointer or help will be greatly appreciated. Once again Thank You for sharing