Check out example codes for "mpld3 tutorial". It will help you in understanding the concepts better.

Code Example 1

html_str = mpld3.fig_to_html(fig)
Html_file= open("index.html","w")
Html_file.write(html_str)
Html_file.close()

Code Example 2

########################
#Import dependencies
########################

import pandas as pd
import matplotlib.pyplot as plt
import mpld3

Learn ReactJs, React Native from akashmittal.com