Learn the rules of data graphics so you can bend them.

Nathan Yau

This blog post is a summary of my talk at Tableau Fringe Festival APAC. The original workbook you can find here.

I first came across ‘visual encoding’ learning about data visualisation and reading different books (even though I’ve been doing data viz for a few years).

Visual Encoding is basic in data visualisation. You need to know about visual encoding, as it will help you to find clarity when you try to create something using data. Thinking about it logically, formulaically, and in a structured way means you are more consistent. Thus, you can easily explain what you’re trying to do to a reader.

Visual Encoding is a mapping from data to display elements. You, as a data visualiser, encode data visually, and the viewer must decode that information.

Let’s have a look at one simple example. For this, I used the sample data of superstore in Tableau.

Assume, we would like to analyse discounts and profit per country. For this, I put a discount to the x-axis and profit to the y-axis. And this is our first encoding: discount is encoded visually along the x-axis and profit is encoded along the y-axis. For our data visualisation it means, countries that have received less or no discount at all, have a higher profit. (I put also states into the details, just for better interpretation of the data.)

The position is considering a retinal variable because it locates points in space. And it also displays elements that we can perceive with great accuracy. The position is good for encoding two variables.

But what we do if we want to get more information about this visualisation by adding more dimension?

At this chart I added sales to the size, categories to the color and I also animated this graph by time.

This example shows, that I encoded:

  • Sales by size
  • Categories by color
  • Time as animation

visually. Time, in this case, is not a static display element like color, size or position. Time is animated through individual frames in our visualisation.

I used the retinal variable to encode additional variables for this data set. With retinal variables, we encode the information visually. There are seven retinal variables:

Size, color saturation, orientation, position and length are effective for quantitative data. However, it may be difficult to perceive quantitative differences using these visual encodings. They perceive value differences between light blue and light light blue isn’t so obvious.

For this use other retinal variables such as color hue, position and shape. They are great for encoding qualitative data. Note that „position“ is used for both qualitative and quantitative data types.

Let’s go a step further and think about which of the visual encodings are most effective. How should we know whether to encode a quantitative variable in color saturation or rather than say position?

I found on the web a lot of interesting information according to his question. Nathan Yau wrote an excellent article, which you can find here.

He summarised a research paper of Cleveland and McGill, who studied what people are able to decode most accurately and ranked them in the following list.

This list shows, that with the length you encode information more accurate and with the color hue less accurate.

Cleveland and McGill were trying to see how effective using codings in terms of users being able to interpret quantitative information, that is exact numbers from the graphs.
Therefore, the most important variables for our visualisation are discount and profit. They are encoded using position. It is the most accurate of the bunch.
The key takes away here is that if you want to design an effective visualisation, then you need to understand the ranking of visual encodings and choose appropriate encodings in your designs.
However, before you go shunning everything that isn’t in the top three, keep in mind this list isn’t meant to be a definitive answer on what to use and what not to in your data graphics. Cleveland and McGill note, “The ordering does not result in a precise prescription for displaying data but rather is a framework within which to work.”


We saw how we can leverage visual encoding effectively represent and present data. Think of visual encoding as building blocks of graphics. These are components that we can combine in creative ways to construct visualization. An analogy can be drawn to how we communicate information through text. When writing an article, you construct sentences and a narrative by using different parts of speech. So, try to think of the different visual encoding we’ve covered as the nouns, verbs, and adjective of graphics.