I built a Flask app and i would like to embed a chart for my data using Plotly. Making some research on Plotly i found about Dash, and i'm having some troubles deciding which one of the two i need to use for my project. What's the difference between them?
Actually Dash was made by Plotly's creators as a way to easily implement a web interface and create dashboards with Plotly without having to learn javascript, html and other web technologies.
With Dash you don't make visualizations, you build an interface to display Plotly's visualizations.
It uses Flask under the hood so it is specially compatible with other Flask apps. For more info refer to Dash's deployment reference.
Edit:
The reference I point to used to have more information about how to work with Flask, but not so much anymore. There are plenty other tutorials out there though, e.g. this one.
I have asked pretty much the same question on Dash forums and Chris Parmer, the creator of Dash, answered it (how awesome is that?).
You can read the full discussion here:
https://community.plotly.com/t/plotly-ecosystem-explanation/53826/2
But the summary is:
You might want to use Plotly / Plotly Express if you want to add interactive charts to your existing pages here and there and your backend is using some server side language.
You might want to use Dash if you want to build a web app with interactive charting capabilities where everything (frontend and backend) is handled with the tools that Dash provides.
PS: Dash can also inject interactive charts to your existing pages using either iframes or Dash enterprise solution (paid).
Related
I've done some analysis using Pandas on a csv file and have created a number of graphs using matplotlib and plotly.
I'm trying to get these graphs in a html page so my team can see them on a dashboard.
I know it's possible to download the image and embed into html, however, the csv file I performed my analysis on will be constantly updated i.e. I need a way of include the graphs on a html page which auto refreshes.
Is this possible?
I think it would be possible and check pyscrpit
https://pyscript.net/
where you can use python in html
https://github.com/pyscript/pyscript/blob/main/docs/tutorials/getting-started.md
here are some tutorials to get and idea of what I am talking about and to start
Then you can host the html page anywhere you like and they will see when you update it
Voila or Panel to make a dashboard is another way to go. That needs an active Python kernel at this time. (That is as opposed to the pyscript / webassembly route. JupyterLite currently works in WASM and Voila in WASM is in development.) Examining demonstrations available at the Voila Gallery will give you a sense of how it can work. All those example demos are served via MyBinder. And you can use that too, if your code and data can be public. If it cannot be public, you'd need to host a server that only your team can access.
JupyterLite would also be possible if you don't mind your team being able to see the code cells and things that compose your Jupyter notebook stepping through the analysis. That would not require an active Python kernel server-side because it is based on WebAssembly that would run inside the client machine, like PyScript. So all you would need to do was a have a server that can serve static files. That's a lower bar than Voila that would run on the server. How to get started deploying JupyterLite is here.
I would checkout out Dash or Plotly, here you can add generation of the graphs in a callback for isntace. Which would update them when the .csv updates. Good luck!
I have some basic knowledge of python and I am using a Django. I am trying to create drill down operation for various chart in Plotly Dash. I have tried multiple demos from online but I am not able to find any proper tutorials which provides. I have uploaded post in Plotly support, but don't gives a proper links or tutorials.
I was trying to this demo : Drill through bar chart Dash plotly , but this demo is in flask app but i need a code in Django. How do I put this code into Django?. Anyone please share useful demo links or some other tutorials with details which can I use. I need a code in Django project for drill down operation for various chart in Plotly Dash
Context
Based on the Plotly descriptions it seems one can self-host plotly and the dash. However, I did not find an MWE to "self-host" plotly inside a GitHub pages website. (To reduce the number of accounts used in such a visualisation (from 2; 1 for GitHub 1 for Plotly, to just one for GitHub)).
Note
"Self-hosted" is in quotations because hosting a page on GitHub is not self-hosting, however, often one can take a self-hosted webpage and host it on GitHub pages. I assume if one can host plotly on GitHub pages, one can also self-host it. And my first approach would consist of simply pushing the self-hosted website with an interactive plotly graph, to GitHub pages. I did not yet find an MWE for this.
Question
How can one host an interactive plotly graph with a slider, inside a GitHub pages website without Plotly account?
Example
This is an example of an interactive Plotly graph with a slider:
I have a Python script that ingests GFS model data and plots it using matplotlib. How do I get those exact plots to display on a website? I am currently using PythonAnywhere to build my webpage.
It looks like Python Anywhere has a variety of options for how you can host your website/web application--so the details of how to do this will depend on how you are hosting your site.
One option is Flask, and I'll just point you to Matplotlib's example on embedding Matplotlib within Flask.
Another option is to generate the plots statically somewhere, and then upload them into your static website content. I'm not sure how exactly one one would go about that with Python Anywhere.
I'm using retentioneering library with python for analysing complex user behaviors in a website and show it as a graph.
Everything works as expected but now, I would like to provide access to this plots also to other people using a web app built with flask.
This is the result given from retentioneering: retentioneering graph result where you can select various "filters" and drag node to change their location.
I would like to create a web app with this exact graph and filters provided by the library plus, as I said, the drop down.
The problem is that the graph is not just an image but something a user can interact with, so my question is: how can I show it in a dynamic way like here? Is there some specific html object I should use?
Thanks.
Investigating a bit more on how retentioneering works it turns out that the final return value is basically an html with javascript that create the graph.
So using flask displaying this html is really straightforward using the render_template function.