Skip to content

Instantly share code, notes, and snippets.

@BrunoGomesCoelho
Created April 11, 2022 01:55
Show Gist options
  • 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