Created
April 11, 2022 01:55
-
-
Save BrunoGomesCoelho/1c02222ffa59198ee03fc75e5d31d21f to your computer and use it in GitHub Desktop.
Embed a plotly figure in jupyter
This file contains 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
def embed_plotly(fig): | |
""" | |
See https://plotly.com/python/static-image-export/ | |
""" | |
# not sure if this import will work outside jupyter | |
from IPython.display import Image | |
img_bytes = fig.to_image(format="png") | |
return Image(img_bytes) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment