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.
For this post, I choose to introduce Plotly and Dash in Python. The reason is that Python is a programming language that provides powerful libraries for Data Science in general and the learning curve can be smoother than with d3.js.
Thus, doing your data analysis and exploratory visualization in Python is certainly very convenient and powerful these days. That being said, it should not be that you feel confined to Python or any other programming language or analytics tool for that matter.
It’s just that through this article I would like to point you to a path I have followed and know best. Feel free to carve your own path if this road is not suitable for you.
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.
Thankfully, Plotly comes to the rescue. It is a Python library that provides the ability to create beautiful and interactive data visualizations.
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.
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 comments or questions I would love to read them below.
Also, be sure to follow me on social media (links in the sidebar) or contact me directly here.