In this post, I would like to introduce an option for interactive data visualization in Python. More specifically, I will introduce the importance of Data Visualization and then talk about interactivity. Subsequently, I will introduce the Plotly and Dash framework in Python. I will also talk about the importance of dashboards in Data Science. Finally, I will conclude by pointing you out to a very helpful online course and a small coding tutorial I have made and uploaded on Github.
The importance of Data Visualization
At first, someone would ask why we should even care about Data Visualization. Isn’t Data Science all about Machine Learning, Neural Networks, and AI? Well, I hate to break it to you but Data Science is not ONLY about the fancy concepts mentioned above. In fact, Data Visualization is a fundamental step in every Data Science project. Why?
- Because it helps tremendously in understanding the data we work with. Effective Exploratory Visualization is part of every successful Exploratory Data Analysis (EDA).
- Moreover, Data Visualization can help immensely in getting our message across. It can be the make or break of a presentation of your results to the stakeholders and/or customers. The reason is that of course, an image is a thousand words. With an effective data visualization, you can explain concepts more easily and fast.
The importance of Interactivity
It may be that an image is a thousand words, however, a static image is much less effective than an interactive one. Interactivity can help in two ways:
- It gives you the ability to explore details of your data in ways that a static visualization cannot. That serves as a tool for your exploratory analysis.
- On the other side, it gives the end-user the ability to do the same. Also, it gives the user a sense of control which in the end means also better user experience.
Why not Matplotlib?
Many of you may have heard of matplotlib as the most frequently used visualization library in Python. And indeed it is. The problem is that if you want your visualizations to be interactive, then matplotlib is not the ideal choice, as the visualizations it provides are static. There is the possibility to use a wrapper called mpld3 that brings some interactivity to matplotlib plots, but still, I would not say it is ideal.
More than Visualizations – Dashboards
Plotly is all nice but why stop there? You can learn to build awesome-looking, interactive dashboards with the use of the Dash framework. Dash is written on top of Flask, Plotly.js, and React.js, but the beauty of it is that you don’t have to know what any of these means in order to use it. Using Dash and the Plotly plots it provides you can create awesome interactive data visualizations and data dashboards in Python in no time while writing nothing more than Python code!
I can already hear you asking. Why learn to create a dashboard in the first place? Well, I would like to give you three solid reason to pay more attention to data dashboards:
- They can help you automate your own analysis and become a tool to help you understand the data you are working with.
- They can summarize your results and help you communicate them easily to others.
- They can serve as the product you provide to your customer or even be the main product of your own company. After all, Software as a Service (SaaS) is a thing, right?
If you are eager to get started with Plotly and Dash I have myself created a tutorial on Jupyter Notebook that I have uploaded on Github. It’s the same notebook I used for giving a hands-on tutorial to my colleagues at the PDEng program Data Science that I am a part of. You can find the code of the tutorial on Github here. In it, I go through the necessary steps to understand Plotly and Dash as fast as possible and start building dashboards and interactive data visualizations yourself fast. I have also added some tips on HTML/CSS that helped me when I started out. However, if you want to delve deeper and understand more I have you covered.
Udemy Online Course
There is an awesome online course that I followed and helped me to start out by Jose Portilla, whose course on Python for Data Science and Machine Learning I already reviewed in a previous post. This course is fantastic as well and takes you step by step so I would certainly recommend it if you are starting out.
Note: This is an affiliate link. It helps me run this website at no additional cost to you. If you don’t want to feel free to use another link to get to the course. Thanks!
Finally, some helpful additional resources I recommend for Plotly and Dash are:
-Plotly/Dash Documentation https://dash.plot.ly/
-My tutorial on Github: https://github.com/amChristonasis/Dash-Plotly-Dashboards-Tutorial
-A collection of awesome Dashboard Examples with Code: https://github.com/ucg8j/awesome-dash
I hope you found today’s post useful and hopefully understood the importance of interactive data visualizations and dashboards. If you have any questions be sure to let me know in the comment section below.