October 22, 2024
Chicago 12, Melborne City, USA
HTML

Export Plotly figure to show in ReactMarkdown


I want to create an interactive graph in Python using Plotly, and then export the graph (or html) to view in ReactMarkdown. One of the bigger issues is that I don’t have access to the html file for this. A different script is run by someone else to convert the Python code to ReactMarkdown.

I was able to do this with static graphs using imgur to host, but I can’t seem to figure out a way to do it with interactive graphs in Plotly. I also tried the instructions on this tutorial, but couldn’t get it working. Any ideas?

Example code:

import plotly.graph_objects as go

# Create a basic Plotly figure
fig = go.Figure(data=[go.Bar(y=[2, 3, 1])])

# Save the figure as an HTML div
fig.write_html("plotly_chart.html", full_html=False)



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video