Displaying Plotly graph written in HTML file
Can anyone help me please:
I can not display the graph in browser which is saved in html file by fig.write_html or Plotly.offline.plot even auto_open is true.
I am expecting a new tab or file open in browser which is g.chrome and show html but nothing happens.
This might be late but if anyone is looking for a solution you can use Dash to provide an http server and serve the chart as an html page. See the example here: https://plotly.com/python/line-charts/#line-charts-in-dash
Here is an example code
import plotly.graph_objects as go import dash import dash_core_components as dcc import dash_html_components as html fig = go.Figure(data=go.Bar(y=[2, 3, 1])) app = dash.Dash(__name__) app.layout = html.Div([ dcc.Graph(id="line-chart", figure=fig), ]) app.run_server(host="0.0.0.0", debug=True)
sadly i am still not able to render plotly graph in replit
@tangert hi. Could you please have a look at my question?
hi @OzkanOzturk, sorry for the late response! I was sick. can you please provide a link to the repl or make a new post with it so we can reproduce the error?
@tangert hey, i am having the same issue!
plotly graphs don't render at all while matplotlib works fine
Your expecting your repl to open a new tab in your broswer, but replit cant do that. What you can do is learn how to use the flask module to load the webpage and display it. I'm not an expert on flask, but there are good tutorials on the internet