How to Visualize Data Usefully
By: Eric Ng
Tags: Charts, Data Visualization, Data Science, Plotly

How to Visualize Data Usefully

Image by author, edited screenshot from https://youtu.be/hfXqgH2RscE?t=132

Useful data visualization should serve a purpose

For something to be useful, it should serve a purpose.

If we don’t have a purpose in mind when we are creating some charts or tables, they are bounded to be NOT useful, because you have never expected them to do anything. Those charts generated would simply be an API call output of a chart library.

I can think of 3 common types of purpose to be served by a chart/table:

To explore: understand the data set, discover patterns To explain: highlight a pattern, suggest a theory, prompt for an action To impress: amuse people, arouse curiosity

There are different things to pay attention to if we want a data visualization to be useful for different purposes.

Purpose 1: To explore

If our purpose of visualization is to explore the data, make it easy for yourself is the most important thing you should care about. The data set we are visualizing is likely to be one that we are not too familiar with, and the goal is to discover something we didn’t know, or to find evidence of some ideas that we suspect to be true.

If you can’t easily to study the data set in different angles, you won’t.

3 principles to explore data usefully

Do it quick and dirty

Being quick and dirty means we don’t need to worry too much about the “look” (e.g. number format, axis consistency across subplots, clear labeling), as long as it doesn’t “defeat the purpose”, which is to discover patterns from an unfamiliar dataset. Microsoft Excel was the most popular choice for this purpose, and nowadays it is Jupyter notebook/lab. Both embrace this quick and dirty mentality.

That said, if it becomes too dirty and you no longer understand what your chart is showing, then it is no longer useful. So need to strike a balance between speed and cleanness (e.g. use of variable names, number format, ease of replicating the chart). Make it interactive

Use a charting library which supports generating interactive charts. Exploring data with an interactive chart is “quicker” than a static chart, because you can create another static chart out of an interactive chart by zooming in/out, or exclude certain groups by unchecking the legend. Plotly is a great library for this.

Use interactive charting library to speed up data exploration. Source: Image by author, screenshot from https://plotly.com/

3. Show it with more relevant fields

The main chart area usually shows at most 3 to 4 dimensions (by x-axis, y-axis, color, size), but it is common for a dataset to have a lot more columns than that. When we are exploring a dataset, seeing data in more dimensions within a view can help us discover patterns more easily. Showing those extra dimensions in tooltip (i.e. the popup when hover over the data) can be useful. In Plotly express (a high level wrapper of Plotly), we can show extra data fields in tooltip by passing in the hover_data argument.

Use tooltip to add extra data in context. Source: Image by author, screenshot from https://plotly.com/

Purpose 2: To explain

If our purpose of visualization is to explain, then make it easy for the others is the key. We may have discovered some patterns/ideas when you were exploring the data, and now we want the others to see the same patterns/ideas and agree with you, let those people be your boss/Medium readers.

To make a useful visualization for this purpose, don’t make your audience think.

It means your visualization should be “self-evident, obvious, self-explanatory. Audience should be able to “get it” — what it is and how to read it —without expanding any effort thinking about it.” [2]

How NOT to visualize your data to share an idea

Imagine your friend shared a Youtube video to you, you clicked the link and the video looked like this:

Image by author, edited screenshot from https://youtu.be/hfXqgH2RscE?t=132

The video is difficult for you to watch because it:

Has no title

Subtitles: in Korean (assume you don’t read Korean)

Shows a lot of statistics of the video that you don’t understand, and blocking the face of lady being interviewed

Video resolution: 144p

Time format: 1617559134 / 1617559734 (in weird Unix timestamp format)

It is very easy to create a chart that looks like the above Youtube video. Usually using the default settings will do.

A good chart should be like a Youtube video

If you don’t want your explanatory chart looks like that weird video to your audience, remember to: