There are several older examples of plotly and flask out there, but I have not found any that work with current versions of plotly; everything I see is now Dash.
I have a project that needs more stateful approach, so Dash is not working for me. Does somebody have an example of flask and current plotly?
Thanks!
Charles
I found that this example plotly/plotlyjs-flask-example: A simple plotly.js example served with flask (github.com) does work once you fix the issue of the template:
Does not display for me in Chrome and safari · Issue #2 · plotly/plotlyjs-flask-example (github.com)
Replace this line...
`<script src="https://d14fo0winaifog.cloudfront.net/plotly-basic.js"></script>`
...with this line...
`<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>`
It worked for me after that.
Glad you found an answer. I’m new to plotly and evaluating plotly/dash vs current work in bokeh/flask. I’d love to hear more about why you decided against dash and to just display your plots directly in flask templates instead.
I’ve been stashing state in dash’s Store object.
Hi @jcarson,
I’m new Dash as well. I’ve been playing with it, but am so far still more comfortable in Plotly/Flask. Not only the ease of state in Flask, but also I’m having an easier time having a function where I create not only the plots, but also dynamically control the layout. (It might very well be the case that this is just as easy in Dash and I just haven’t found the right example yet.)
Cheers,
Charles
p.s. I was looking for how I could pass extra parameters into Dash, but I found the answer in this question on the forum.