Interactive Visualizations with Python

“Visualization gives you answers to questions you didn’t know you had.” — Ben Schneiderman

Esteban Solorzano
Jul 2, 2020 · 3 min read

Today there is a huge amount of information in everything we use, large companies depend on and benefit from this information to make good decisions that allow them to grow.

However, the fact that each of us as users generate too much information, may not be enough because it is useless or disorganized, so it will depend on cleaning and transformation to be used properly.

And yet it is not enough.

Data visualization is a graphical way to represent information, it provides us with an accessible way to understand behavior patterns, preferences, trends, and other information that is useful to us as developers, data scientists or entrepreneurs.

Although multiple tools allow us to create these visual elements, this time I will give an introduction to a Python library called Dash.

Dash

Dash is a framework for Python written on top of Flask, Plotly.js, and React.js. It is a library designed to create web applications focused on data visualization, it’s very complete even if you don’t know React, you can make a complete application using only Python.

Here’s a simple example of a Dash App that ties a Dropdown to a D3.js Plotly Graph. As the user selects a value in the Dropdown, the application code dynamically exports data from Google Finance into a Pandas DataFrame.

Image for post
Image for post
A basic example of a Dash App

Dash applications are composed of 2 different parts, the first one describes how the application looks like and the other one describes the interaction of its components.

This library provides a couple of modules with which through Python we can generate different HTML elements, containers, buttons, text fields, and most importantly Graphics. Each of these classes we use to create applications is what we know as Layout.

In the case of Interactivity, Dash provides some functions which will work as Callbacks that will be executed automatically when any property of our elements changes.

The previous example was written in just 43 lines of code:

Since it is built using the Flask micro-framework, it allows in a very simple way to raise your server. And every setting or extension can be used to create even more complex applications.

And as they mentioned in their announcement, being able to use React to build great interactions of the elements practically in “real-time” is fantastic and more than this is easy to create because Dash takes advantage of both libraries for those who may not be experts in web development and can do everything from Python.

Image for post
Image for post
Reactive Web Apps using Python Dash

As I mentioned at the beginning, there are many tools for data visualization, some more complex than others. However, it is always good to know the advantages or limitations and choose the one that is useful for you.

Remember you can use Dash to create any kind of application. Check out their gallery.

Additional resources

Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Sign up for Best Stories

By Dev Genius

The best stories sent monthly to your email. Take a look.

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Esteban Solorzano

Written by

Software developer with passion for technology and development. https://estebansolorzano.com

Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Esteban Solorzano

Written by

Software developer with passion for technology and development. https://estebansolorzano.com

Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store