{"id":290,"date":"2021-09-06T00:00:00","date_gmt":"2021-09-06T00:00:00","guid":{"rendered":"https:\/\/tac.debuzzify.com\/?p=290"},"modified":"2023-06-27T05:15:02","modified_gmt":"2023-06-27T05:15:02","slug":"plotly-dashboards-in-python","status":"publish","type":"post","link":"https:\/\/www.the-analytics.club\/plotly-dashboards-in-python\/","title":{"rendered":"How I Create Dazzling Dashboards Purely in Python."},"content":{"rendered":"\n\n\n

I don’t have to convince you why we need an interactive dashboard. But most people don’t know that they don’t have to buy expensive licenses of Tableau<\/i> or PowerBI<\/i>. You don’t have to enroll in a JavaScript<\/i> course, either.<\/p>\n\n\n\n

Dash<\/i> apps allow you to build interactive dashboards purely in Python. Interestingly, it could reach heights that popular BI platforms can not.<\/p>\n\n\n\n

Unlike other tools to create dashboard web applications, you can host Dash apps on your servers and terms. You can use this tool for various use cases, from a key performance indicator dashboard for your employees that changes once a month to a real-time network monitoring dashboard.<\/p>\n\n\n\n

\n

I strongly recommend the book, Interactive Dashboards and Data Apps with Plotly and Dash<\/b><\/a> because it gives an in-depth understanding of interactive dashboard design.<\/p>\n\n\n\n

Other resources about Dashboards and Data Visualization:
The Big Book of Dashboards<\/b><\/a>
<\/b>
Storytelling with Data<\/b><\/a><\/p>\n<\/blockquote>\n\n\n\n

\n
\n
\n

Grab your aromatic coffee <\/a>(or tea<\/a>) and get ready…!<\/p>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n

Why Dash? Why not Tableau, Power BI, or some JavaScript library?<\/h2>\n\n\n\n

BI Platforms such as Tableau<\/a> and PowerBI<\/a> do a fantastic job. It allows even non-technical managers to do data exploration themselves<\/a>. I don’t have complaints about them.<\/p>\n\n\n\n

They are excellent tools for performing analysis on read-only datasets. But in a large data science project<\/a>, you’ll have to perform complex actions. For instance, you must trigger a backend function and start the model retraining.<\/p>\n\n\n\n

In such cases, my best solution was to build a web app from scratch<\/a>. JavaScript data visualization libraries such as HighCharts<\/a> are excellent tools for this. They have callbacks for almost every possible user action. I use them to send data back to the server and control it better.<\/p>\n\n\n\n

Related:<\/b> How to Make a PDF Text-to-Speech Reader in Python<\/i><\/b><\/a><\/p>\n\n\n\n

But this wasn’t a walk in the park. My data science team is exceptional in Python and R but not JavaScript<\/i><\/a>. N<\/i>ot on web frameworks such as Django<\/i><\/a> either. And that’s not enough; to build modern web apps<\/a>, you need frontend<\/i> web frameworks such as React <\/i><\/i>.<\/p>\n\n\n\n

As we progressed, we realized the harsh truth. Every new technology in our stack inflates the difficulty exponentially.<\/p>\n\n\n\n

And we were fortunate to find Dash<\/a>\u2014a pure Python open-source web dashboard framework. If you’re comparing Plotly dash vs. React, Dash is built using React, so you don’t have to do the heavy lifting for yourself.<\/p>\n\n\n\n

 Now, this is how I create my own web dashboards in Python. If you’re looking for a lightweight alternative, check out Streamlit<\/i><\/b><\/a>.<\/p>\n\n\n\n

 Read along if you need flexible, custom dashboards entirely in Python. There’s also an amazing extension to this package that lets you create Dash apps inside Jupyter Notebooks<\/a>. See its repository for more Jupiter dashboard examples<\/a>.<\/p>\n\n\n\n

Streamlit vs. Dash vs. Gradio<\/h3>\n\n\n\n

Both tools are great for building a dashboard web application. But streamlit is more focused on building quick control panels for ML projects. Plotly is excellent for building cool dashboards at ease.<\/p>\n\n\n\n

Another excellent alternative to creating a dashboard web application is Gradio<\/a>. With gradio, you can even create a dashboard in Python Jupiter Notebook.<\/p>\n\n\n\n

If you create your web dashboard app in either Streamlit<\/a> or Gradio, it could also work on mobile devices. Your Plotly dashboard app may need a bit more optimization for this.<\/p>\n\n\n\n

Building your first dashboard in Python (in less than 1 minute.)<\/b><\/h2>\n\n\n\n

Yes, building dashboards in Dash is that simple. Install Pandas and Dash with the following command, then start the timer.<\/p>\n\n\n\n