Skip to content

Instantly share code, notes, and snippets.

@BrunoGomesCoelho
Created April 11, 2022 01:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BrunoGomesCoelho/1c02222ffa59198ee03fc75e5d31d21f to your computer and use it in GitHub Desktop.
Save BrunoGomesCoelho/1c02222ffa59198ee03fc75e5d31d21f to your computer and use it in GitHub Desktop.
Embed a plotly figure in jupyter
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