1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Export Plotly figure to show in ReactMarkdown

Discussão em 'Python' iniciado por Stack, Outubro 25, 2024 às 12:32.

  1. Stack

    Stack Membro Participativo

    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. This is part of a company-wide challenge, so I don't have access or know anything about the script. I believe it is using React Markdown, as html isn't showing up.

    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)

    Continue reading...

Compartilhe esta Página