I am using the mpld3
Python package to save out static matplotlib
figures as interactive images in the html format. A quick example is the following:
# draw a static matplotlib figure
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = plt.axes()
x = np.linspace(0, 10, 1000)
ax.plot(x, np.sin(x))
# save as an interactive html file
import mpld3
html_str = mpld3.fig_to_html(fig)
Html_file= open("sample.html","w")
Html_file.write(html_str)
Html_file.close()
But the problem is that when opening the html image in a browser, it is always on the top-left. Is there a way to make it center or even have more control of the output style?