Seven dirty secrets of data visualization

Written with Nick Rabinowitz.1

Data visualization - and in particular, web-based data visualization - is having its moment. JavaScript libraries like D3.js, Raphaël, and Paper.js, building on modern browser support for Canvas and SVG, have made it easier than ever to produce complex visualizations that, until recently, were the province of computer scientists and a handful of specializt designers.

Visualization is the new ‘must-have’ element in project proposals and personal portfolios, and startups like Platfora, Datameer, and our own employers ClearStory Data and Chartio are raising millions for analytics platforms with browser-based visualization interfaces.

To some extent, the buzz is justified. Data visualization is a wonderful way of exploring data, finding new insights, and telling a compelling story. But what are the real challenges visualization developers face - and what don’t they want you to know about their work?

We’ll lead you through some of the dirty secrets of the information visualization (infovis) profession, offering an inside look at the process of visualization development, along with practical tools and approaches for dealing with its inevitable challenges and frustrations.

Secret #01: Real data is ugly

Most data visualization tutorials start with a pleasant fantasy: a pristine data set. Whether you’re learning to build a basic bar chart or a force-directed network graph, you’re presented with clean, normalized, well-formatted base data. This perfect JSON or CSV file is the digital analog of the neatly prepped mise en place in a televised cooking show: the refined result of tedious, painstaking work presented as raw ingredients. In practice, when dealing with most real-world data sets, expect to spend up to 80 percent of your time finding, acquiring, loading, cleaning and transforming your data.

Some of this process can be done with automated tools, but almost any data cleaning involving two or more data sets will require some level of manual work. A wide variety of tools can convert XLS to XML or timestamps to other date formats, but nothing can automagically map one company’s internal sales categories to those of its competitors, or deal reliably with data entry typos, incompatible character encodings, or (shudder) poor OCR.

Tools and strategies

Secret #02: A bar chart is usually better

A bar chart, bubble chart, doughnut chart and treemap showing the same data by US state

Compared to bar charts, bubble charts support more data points in less space, doughnut charts clearly indicate part-whole relationships, and treemaps support hierarchical categories - but none match simple bars for fine-grained comparison

One of the first questions to ask when considering a potential visualization design is “Why is this better than a bar chart?” If you’re visualizing a single quantitative measure over a single categorical dimension, there is rarely a better option. Likewise, time-based data is usually best displayed on a line chart, and scatterplots are often best for exploring correlations between two linear measures. At the risk of sounding regressive, there are good reasons these charts have been in continuous use since the 18th century. Bar charts are one of the best tools available for facilitating visual comparisons, leveraging our innate ability to precisely compare side-by-side lengths.

The corollary to bar chart superiority, and perhaps the dirtiest secret in this article, is that the coolest-looking visualizations are often the least useful. The novelty and aesthetic appeal of custom visualizations comes at a cost: the clarity of the data. Most bar chart alternatives ask the viewer to compare differences we have a harder time discerning: areas, angles, hues, or opacities. At best, such visualizations make comparison difficult; at worst, they distort the data entirely, leading viewers to false conclusions.

Tools and strategies

Secret #03: There’s no substitute for real data

Cleaning and formatting a single data set is hard enough, but what if you’re building a live visualization that will run with many different datasets? Maybe you have to build a visualization for use in multiple departments within one company, where every department has its own database, and you don’t have time to manually clean each dataset. Your first instinct may be to grab some demo data and use that to build your visualization; your visualization library may even come with standard sample data.

Unfortunately, there is no substitute for real data. Demo data tends to have a normal distribution and a manageable number of records; it’s designed to show visualizations in their best light. A bar chart doesn’t just have the prerequisite bars, it looks like an ideal bar chart. It doesn’t help you plan for data discrepancies, null values, outliers, or other real-world problems. If you rely too much on demo data, when you plug in real data you may find that your visualization isn’t the best one suited for your data to begin with.

Tools and strategies

Secret #04: The devil is in the details

Three bar charts of the same data with horizontal, rotated and abbreviated axis labels

Laying out labels horizontally can quickly lead to crowding and illegible text (top). Rotating labels 90 degrees improves legibility, but takes away significant space from the visualization. Finding a truncated or abbreviated label format is one approach, but won’t work for every data set

Designing the labels, legends and axes for your visualization is often an afterthought to the initial visualization. But these elements are crucially important to the visualization, and can be difficult and time-consuming to get right, especially when you can’t predict the data ahead of time.

When laying out your visualization, leave significant rendering space for any additional marks you may need, often including relatively wide margins around the graphical part of your visualization. Axis labels should be spaced such that they do not occlude each other and are easily readable. Use rotate or reposition labels if necessary for legibility. If a particular area is overcrowded with labels, but you need them for clarity, consider moving the labels farther from the elements they reference and connect them with an indicating line. Another technique is to group crowded labels together in a single tooltip-like group. Consider the space you’ve allowed and the length of the longer labels. If the labels won’t fit you might need to shorten them with ellipses, or simply truncate the text at a fixed length.

Similarly, legends require advance planning to render well. One easy option is to reserve some space for the legend to one side of the graphic. Unfortunately, this means that you’ll need to reduce the size of the graphical portion of your visualization. In order to preserve some space you may be able to place the legend in an empty part of the graphic, or make the legend draggable so the viewer can access any graphics underneath.

Tools and strategies

Secret #05: Animate only when appropriate

As a visualization author, it’s often tempting to add animations into your final product. Animations are a powerful way of connecting data to changes in state and trends. However, animations can also lead to confusing or misleading interpretations of your data. You should carefully plan for how it will affect your entire output and not simply add it at the end of your work. Animations work best when they can reveal data relationships showing how data groups together between different states, how the data changes over time, or how data points are directly related.

In general, make your animations simple, predictable and re-playable. Allow users to view the animation multiple times so they can track where objects start and end. Avoid occluding objects in a transition with other objects, which makes tracking more difficult and do not transition objects along unpredictable paths. With complex animations, research suggests that viewers’ comprehension improves when the animation is broken into simple ‘staged’ transitions. A stage pauses the animation with the objects in a transitioning state and provides the viewer a moment to reflect on the state of each object.

Tools and strategies

Secret #06: Visualization is not analysis

It’s a central tenet of the field that data visualization can yield meaningful insight. While there’s a great deal of truth to this, it’s important to remember that visualization is a tool to aid analysis, not a substitute for analytical skill. It’s also not a substitute for statistics: your chart may highlight differences or correlations between data points, but to reliably draw conclusions from these insights often requires a more rigorous statistical approach. (The reverse can also be true - as Anscombe’s Quartet demonstrates, visualizations can reveal differences statistics hide.) Really understanding your data generally requires a combination of analytical skills, domain expertise, and effort. Don’t expect your visualizations to do this work for you, and make sure you manage the expectations of your clients and your CEO when creating or commissioning visualizations.

Tools and strategies

Secret #07: Data visualization takes more than code

The range of libraries and tutorials now available make it easier than ever to produce production-quality web-based visualizations without specialized expertise. But creating visualizations that offer real insight or tell a compelling story still requires a particularly wide range of real skills in addition to coding, including graphic design, data analysis, and an understanding of interaction design and human perception. No library or technology can substitute for knowing what you’re doing.

But the flip side of this secret is that you don’t need to know that much - especially if you use well-established visualizations and interaction principles. Learn enough about the field to avoid newbie mistakes (always zero-base your bar charts and never set a circle radius with a linear scale), keep things simple (no 3D, limited animation, no drop shadows), base your work on solid examples and you can create great visualizations.


At the time of writing, Nick Rabinowitz was the Senior Data Visualization Developer at ClearStory Data. Nate Agrin was the Director of Visualization at Looker.

Footnotes

  1. This article was originally published in another publication in February 2013 and, for whatever reason, now lives on Creative Bloq. ↩