Exporting and Sharing Interactive Visualizations
When you create interactive visualizations with Plotly, you have several options for exporting and sharing your charts. Plotly makes it easy to save your work as static images, export interactive HTML files, or display charts directly inside Jupyter notebooks. Each method serves a different purpose, depending on how you want others to view or interact with your visualizations.
# Save as a static PNG image
fig.write_image("plot.png")
# Save as an interactive HTML file
fig.write_html("plot.html")
In the previous code, you used two export methods. The write_image method saves your Plotly figure as a static image, such as PNG. This is especially useful when you need to include your chart in presentations, documents, or publications where interactivity is not required. The write_html method saves the chart as a standalone HTML file, preserving all interactive features like zoom, hover, and selection. Sharing the HTML file allows others to explore your visualization in any web browser, making it ideal for collaboration or publication on the web.
# Display the chart in a Jupyter notebook cell with custom height
fig.show(config={"displayModeBar": True}, height=1000)
When sharing interactive visualizations, consider your audience and their needs. Static images are best for printed materials or situations where interactivity is unnecessary. Interactive HTML files are perfect for sharing via email, cloud storage, or publishing on websites, as they allow viewers to explore your data firsthand. Embedding charts in Jupyter notebooks is excellent for collaborative data analysis or educational purposes, letting you combine code, narrative, and visualization seamlessly. Always choose the export or embedding method that best matches your sharing scenario, and remember to test your exported files to ensure they display as intended for your audience.
Thanks for your feedback!
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 11.11
Exporting and Sharing Interactive Visualizations
Swipe to show menu
When you create interactive visualizations with Plotly, you have several options for exporting and sharing your charts. Plotly makes it easy to save your work as static images, export interactive HTML files, or display charts directly inside Jupyter notebooks. Each method serves a different purpose, depending on how you want others to view or interact with your visualizations.
# Save as a static PNG image
fig.write_image("plot.png")
# Save as an interactive HTML file
fig.write_html("plot.html")
In the previous code, you used two export methods. The write_image method saves your Plotly figure as a static image, such as PNG. This is especially useful when you need to include your chart in presentations, documents, or publications where interactivity is not required. The write_html method saves the chart as a standalone HTML file, preserving all interactive features like zoom, hover, and selection. Sharing the HTML file allows others to explore your visualization in any web browser, making it ideal for collaboration or publication on the web.
# Display the chart in a Jupyter notebook cell with custom height
fig.show(config={"displayModeBar": True}, height=1000)
When sharing interactive visualizations, consider your audience and their needs. Static images are best for printed materials or situations where interactivity is unnecessary. Interactive HTML files are perfect for sharing via email, cloud storage, or publishing on websites, as they allow viewers to explore your data firsthand. Embedding charts in Jupyter notebooks is excellent for collaborative data analysis or educational purposes, letting you combine code, narrative, and visualization seamlessly. Always choose the export or embedding method that best matches your sharing scenario, and remember to test your exported files to ensure they display as intended for your audience.
Thanks for your feedback!