Last active
March 14, 2023 21:29
-
-
Save marcocamma/d84d283522d3a42cd3f6eef4c6643c81 to your computer and use it in GitHub Desktop.
Exporting matplotlib figure as interactive plotly figure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tested with plotly 5.13.1, matplotlib 3.5.3 | |
from matplotlib import pyplot as plt | |
import plotly.tools as tls | |
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot | |
plt.plot([1,2,3]) | |
fig=plt.gcf() | |
fig_plotly=tls.mpl_to_plotly(fig) | |
fig_plotly.write_html("my_image.html") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment