Alcohol and radar plots in R with ggplot2

Radar plots may be an unusual way to represent data, but under the right circumstances they can provide meaningful visualizations. In this post I will present how to create and customize some basic parameters of radar plots in R programming language.

Make sure you have the following packages:

require(ggplot2)
require(tibble)

The easiest way to generate good-looking  yet simple data visualization is through the syntax of Grammar of Graphics, cleverly implemented by Hadley Wickham in his ggplot2 package. The tibble package, created by this same author, provides an alternative to the use of dataframes. In this post we’ll give it a try.

The database used in this example can be found at The World Health Organization Global Health Observatory data.

Radar plots are generally used to represent higher dimensional data in two dimensions. It does so by plotting each variable into a separate axis resembling polar coordinates. Each axis is arranged radially from the center at an equi-angular distance from each other. Then each observation is potted according to the value presented on each category, usually joined by a line forming a polygon.

Nevertheless, this way of representing data can be misleading. For instance, the use of many axis can interfere with the visualization. Furthermore, the use of different units among axis (and unit separations) is regarded as inappropriate. A general critique of radar plots can be found here.

Taking in account the possible downsides when using radial plots, we proceed to obtain and clean the data with the following code:

Cleaning is also important in the process of data exploration. In this case we get rid of some useless variables and add some rows concerning the average data.

Now we continue with the visualization. At first we plot all the observations we have. Then we move on to select specific cases to show how can radar plots can contribute to a better understanding of the data.

As a result, the following plots are generated:

general_radial

In this plot we can see the 53 different countries in a radar form. The radar plot is not a good alternative to graph many observations. The shapes generated for each observation are indistinguishable  from each other. For this reason, it was decided to use the same color except in the average data. So at the end, this plot is merely illustrative.

rend

The previous graph made obvious the need to reduce the number of observations. In this case 5 countries were randomly selected. Now we are able to see the observations and their consumption pattern.

select

To understand the nature of this radar plots, sometimes it is useful to use data you know. For this reason we selected some countries from which their alcoholic consumption preference are obvious. As stereotypes dictate, France shows a strong preference toward wine consumption, Germany toward beer and Russia toward spirits. We can clearly see and compare the consumption patterns for each country.

ir

At a glance, the presentation of data in this format is really useful. The radar plot points toward the direction with more consumption per country. We can think of the shape of this plots as a “preference polygon” for each country. In this view the plots don’t overlap so we have a clean visualization. It provides an overall understanding of the consumption pattern of alcohol by country.

 

At the end, using radar plots is a tricky task. Not all data fits in the format, dimensions or number of observations that can make a radar plot interesting. As a rule of thumb, I would suggest only to use radar plots when you are confident that they can provide accurate meaning. Otherwise, the advise is to avoid them at all.

 

For further information:

This post was inspired by the publication From Parallel Plot to Radar Plot by Erwan Le Pennec.

Useful perspective offered by Graham Odds in A Critique of Radar Charts.