Data Visualization: attribute types and their graphical elements

June 9, 2021

Data can be organized in two main groups: categorical (or nominal) and ordinal. Among the visual elements we have to represent data, some elements naturally represent order and other elements represent identity.

By identifying your data types and using the right visual channels to display them, you can communicate information in a clear way.

Data attribute types

Given a data set, you can identify data types for each of its attributes, attributes in data can be roughly bucketed into two main groups: nominal and ordered.

The data type is tighlty related to the mathematical interpretation of the attribute: what kinds of mathematical operations are meaningful for it? What kinds of comparisons you can do with it?

Data types are not mutually exclusive, nor restrict you from using a numeric value as a nominal quantity, they just allow us to categorize the data and know what kind of visual representation is useful.

Categorical

Categorical attributes define discrete categories or "buckets" that allows to group items in the data set. Examples are book genres, gender, day of the week, year, etc.

Categorical data is also called nominal or qualitative data.

Categories can only distinguish whether two things are the same (apples) or different (apples versus oranges, and thus the only mathematical operation you can perform between two cagtegorical attributes is equality, ie: is A == B?

Categorical data often has a hierarchical structure, for example:

Ordered

In contrast to categorical attributes, ordered attributes have a natural rank that can be used to compare items in the dataset. They allow you to ask is A < B?

The naming might be a bit confusing, but Ordered attributes can be Ordinal or Quantitative.

Ordinal attributes have an intrinsic order without necessarily being numeric, good examples are sizes of clothing (Small < Medum < Large), mood, socio economic status, etc.

Quantitative attributes on the other hand, are numeric, therefore they don't only have an order but also support mathematical operations like difference or ratio.

The graphical elements

A lot of amaizing work has been done figuring out what is the best way to present data with graphics. One way of analyzing what are the components and the language of graphics by analyzing the ways in which a graphic is represented in a given medium (a screen, paper, etc)

There are two main components working together to convey information:

Examples of marks: dots, lines and different areas.

There's an inherent relationship between data types and the different channels, some channels are naturally better at conveying nominal data (eg: hue, shape) and others are best to convey ordinal data (eg: size, saturation).

While some channels are naturally better than others to display certain data types, there isn't a hard rule for any pair, some channels are OK at showing categorical and nominal data as well, or some times the line is fuzzy and you must choose what is best for the visualization at hand.

Position & Spatial Region

A great example that portrays position used to compare ordered data and spatial region to distinguish between categories is a bar chart:

A Bar Chart comparing the number of lines of different characters in the U.S. television series "The Office".
 Example: Cumulative confirmed COVID-19 cases per million vs. GDP per capita

A scatterplot chart uses the position channel to compare two ordered attributes. The position of each point depends on the correlation between the values on both axes.

This chart also makes use of hue to group countries by category.

Source: Our World In Data

 Example: Where Are America’s Winters Warming the Most? In Cold Places.

This chart makes great use of position and spatial region to show differences in temparatures across a time period.

Source: New York Times

Size

 Example: Share of men vs. share of women who drank alcohol in 2010

This Scatterplot Chart makes use of size as an additional channel to convey extra information, at glance we can see the relationship between the values in both axes and also compare how many people drank alcohol between the different countries.

This chart also makes use of hue to group countries by category.

Source: Our World In Data

 Example: The Words Men and Women Use When They Write About Love

This chart is very similar to a Word Cloud, it conveys the frequency of usage of different words by the area (2D size) of each circle.

Hue is also used to separate the circles in two categories.

Source: New York Times

Hue

 Example: Outdoor air pollution deaths by age, World, 1990 to 2016

In this chart, different hue values are used to convey different categories of age ranges.

The size of each band plus the stacking the different colors allows to easily compare and identify trends between categories over time.

Source: Our World In Data

 Example: Does livestock antibiotic use exceed suggested target?

Hue is used in this chart along with geographic information to convey three different categories. The use of different hue values allows to easy pinpoint areas with high consumption of antibiotics.

Source: Our World In Data

Luminance and Saturation

Each row shows variations on luminance (top) and saturation (bottom) for the same hue value.
 Example: GitHub contributions heatmap

In this graphic we can see two categorical variables (day of the week vs month) and the use of luminance to convey an ordered attribute (number of contributions). The rectangles get brighter when the number is higher.

Souce @mbostock GitHub profile

 Example: Disability-adjusted life years (DALYs) from particulate pollution

Luminance and saturation play very well with geographic data, allowing you to see geographic hot-spots easily.

Source: Our World In Data

Motion

When used carefully, motion can be a great channel to convey information, motion is good at displaying the passage of time and periodic

 Example: How to visualize periodicity?

Source: @pierreleripoll - Observable

 Example: Hang On, Northeast. In Some Parts, Spring Has Already Sprung.

Source: New York Times

Angle

 Example: Religion & Attitudes Towards Homosexuality

Source: @gordon.hack - Tableau

 Example: Premier League 2017-18 review: Predictions vs. Reality

Source: @brian7311 - Tableau

Shape

 Example: Women in the German Bundestag by Party

Source @terezaif - Observable

 Example: By age group: The growth of the population to 2100

Source: Our World In Data

Resources