I am trying to plot a stacked graph using Matplotlib in HTML page (python -cgi). I have the following script
`#!/usr/bin/python
print "Content-type:text/html\r\n\r\n"
print '<html>'
print '<head>'
print '<title>Hello Word - First CGI Program</title>'
print '</head>'
print '<body>'
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt, mpld3
data = {'title1': {'SA':20, 'TA':10}, 'title2':{'FA':10, 'MA':20,
'NA':30}}
grap=pd.DataFrame(data).T.plot(kind='bar', stacked=True,figsize= .
(16,18))
mpld3.fig_to_html(grap)
print '</body>'
print '</html>'`
However, when i try to open the script in web browser, it shows error. If i remove "import mpdl3", the script works but the image is not seen.
Could any one help how to embed the plot into a html page.
Thanks in advance.