I am trying to plot the Matplotlib data on my browser using mpld3 library. But the problem that I am getting is I am getting the following Error :
if fig.canvas is None: AttributeError: 'list' object has no attribute 'canvas'
These are the mpld3 objects that I imported.
import matplotlib.pyplot as plt,mpld3
from mpld3 import save_json, fig_to_html, plugins
Here is my code to save the figure in HTML .
plt.subplots(1, 1, figsize=(8, 2))
ecg = X
fig=plt.figure()
alt = np.arange(len(ecg))/125
fig= plt.plot(alt,ecg)
mpld3.save_html(fig,"test.html")
mpld3.fig_to_html(fig,template_type="simple")
mpld3.disable_notebook()
mpld3.show()
I am getting the figure if I am not saving the data in html file. The html file is created but is empty and the Above Mentioned error is being showed on the console.
Please Help. Any Help is really appreciated