• James Smith

A History of Polar Area / Coxcomb / Rose charts & how to make them in R's ggplot2.


I've seen this chart referenced by several different names: Polar Area, Wind Rose, (just) Rose, Coxcomb, or even 'Consulants' chart. I'll start by outlining the history of the chart and some of the differences that I've observed from trawling through the web. Skip past this to the bottom for a technical explanation of how to create something similar in R's ggplot2 package.


First, let's deal with the name. The Data Viz Project bunches the Polar Area, Coxcomb & Rose chart together using the following description:


'The Polar Area chart is similar to a usual pie chart, except sectors are equal angles and differ rather in how far each sector extends from the center of the circle.'


Andy Kirk, author of Visualising Data, categorises them in the same way, though excluding Rose Chart and including Circular Barplot. His definition is slightly more detailed, as below:


'A polar chart shows values for three or more different quantitative measures in the same display. It uses a radial (circular) layout comprising several equal-angled sectors like slices of a pizza, one for each measure. In contrast to the radar chart (which uses position along a scale), the polar chart uses variation in the size of the sector areas to represent the quantitative values. It is, in essence a radially plotted bar chart.'


So, the chart is a cross between a bar chart (using length as a pre-attentive feature) and a pie chart (radial in nature, segments that are wider at the top, thinner in the center, ie. polar coordinates). This helps us understand the form of the chart as means for representing data, but still doesn't tell us why this chart type is so greedy when it comes to having different names!


To answer this, we'll take a glance at the first sightings of this chart in the wild. According to most sources, it first appeared when Florence Nightingale used it in her Statistical Diagrams during the Crimean War to show causes of mortality over the months of the year (see below).



For this reason, it is understandable why it is sometimes referred to as 'Nightingale's Rose' - the segments reaching outwards resemble the form of a rose. As a variation of this, the 'Wind Rose' takes a similar format but the segments are used direction-ally to show wind direction and intensity according to points of the compass. Within the field of Football Analytics, wind roses have been employed to show direction & volume of passes made from a particular position or player.


However, Florence Nightingale never referred to the chart as a Rose herself, this name came later. Nor, contrary to popular belief, did she refer to them as 'Coxcomb' charts. A more detailed explanation can be found here, but it would appear that the name 'Coxcomb' has filtered down through time as a result of a misunderstanding!


What actually is a coxcomb? It can refer to a form of flower, but, given the visual nature of the chart, the misunderstanding is most likely to have been made when comparing it to another definition: the red crest on top of a cockerel's head (see for yourself!)


Essentially, although Nightingale used the word coxcomb in her report, she was referring not to the chart itself, but the positioning of the diagram and the accompanying report at the head of a much larger report: The Royal Commission Report.



We've now covered the Rose & the Coxcomb, which leaves only the Polar Area chart & the (admittedly less well-known and not to be covered in this post) Consultant's chart.


In mathematics, the polar coordinate system is a two-dimensional coordinate system in which each point on a plane is determined by a distance from a reference point and an angle from a reference direction. The reference point is called the pole, and the ray from the pole in the reference direction is the polar axis. This differs from the coordinate system that most of us are used to; the 'Cartesian' coordinate system. This includes our standard x,y coordinates in a linear, vertical/horizontal orientation.

Same Chart using Cartesian (x,y) coordinates

The example to the right is exactly the same chart as the original, but without the coord_polar() instruction in R. You can see why Andy Kirk describes the chart as 'effectively a radially plotted bar chart'. By using polar coordinates, you are wrapping the entire chart around a central point so that it fans outwards in increasing size.


Where it differs to the radial bar chart is in the way it increases in width as you move further from the centre, creating wedges or pizza slices as opposed to rectangular bars. That is where the 'Area' part of the Polar Area chart hails from. I believe this makes Polar Area charts more suited to quick comparison across categories, as we've done in the Arsenal Comparison, because the visualization is making use of both length & width to represent the data. As there is greater surface area covered in the viz, my eye is able to notice the higher and lower values more rapidly & make that comparison across the different players.


So, in conclusion, for the majority of use cases, the Polar Area chart should be this chart's go-to name. Rose/Wind Rose charts are appropriate when the visualization is employing the pre-acquired knowledge of a compass/specific direction, to emphasise movement through the length of each segment. The Coxcomb chart, as we've learned, was named so by mistake, though atleast it maintains the link to the chart's original designer - Florence Nightingale. Ultimately, as with most cases in language, as long as your audience understands what you're talking about, it doesn't really matter what you call it!


Hope you found this useful/interesting! Follow @sportschord on twitter/linkedin for everything R, data viz, Sports & Tableau.

How to make the Polar Area Chart in R


The second part of this blog will now breakdown how to build the Polar Area chart in R. This assumes a basic knowledge of R, RStudio & how to install packages. The full code to create a relatively unformatted Polar Area Chart is below. See beneath for a line by line description. Replace the bold, coloured metrics with your own data frame.


ggplot(data, aes(x=Metric, y=Length)) +

geom_col(fill = "red", alpha=1, width=1)+

geom_hline(yintercept = seq(0, 100, by = 10),

color = "grey", size = 1) +

geom_vline(xintercept = seq(.5, 16.5, by = 1),

color = "grey", size = 1) +

coord_polar()+

facet_wrap(vars(Player))



ggplot(data, aes(x=Metric, y=Length)) +

  • This line calls the ggplot2 package, binds your data to the plot & allows you to select the 'aesthetics' (aes) that will be used for the visualization.

  • In this case, we want our Metric on the x-axis & Value on the y-axis. Remember, we are creating a column chart right up until the coord_polar command.

  • Use the '+' sign to chain the lines of together.

geom_col(fill = "red", alpha=1, width=1)+

  • This calls the geom_col function, required for making our column/vertical bar chart.

  • The fill argument sets the fill colour of the columns. Hex codes/RGB can be used here.

  • The alpha sets the transparency (0=transparent, 1= opaque).

  • The width sets the gap between the columns (0=no bar, 1= touching side by side).

geom_hline(yintercept = seq(0, 100, by = 10),

color = "grey", size = 1) +

geom_vline(xintercept = seq(.5, 16.5, by = 1),

color = "grey", size = 1) +

  • These lines adds some handy grid lines to our chart.

  • geom_hline sets the circular grid lines, geom_vline sets the segment boundary lines.

  • seq() creates a sequence between two numbers, the 'by' argument states the gap.

  • color sets the line colour.

  • size sets the line width.


coord_polar()+

  • The magic happens here. Switch from Cartesian to Polar coordinates.

facet_wrap(vars(Player))

  • Use the 'facet' function to get small multiples per a particular metric. Read more on this here.


All other formatting to the charts, such as adding titles, subtitles, background colours and boxes for the facets can be achieved in the theme(). An example of the theme I created for my Arsenal chart can be found below.


theme(axis.text.x = element_text(size=25,colour = "#063672" ,

angle = seq(-20,-340,length.out = 9),vjust = 100),

axis.text.y = element_blank(),

axis.ticks.y = element_blank(),

axis.ticks.x = element_line(size = 2,colour = "black",linetype = 1),

legend.position = "none",

strip.background = element_rect(colour = "black", fill = "#063672"),

strip.text.x = element_text(colour = "white", face = "plain",size = 45),

panel.border = element_rect(colour = "black",size = 1,fill=NA),

panel.spacing = unit(2, "lines"),

plot.title = element_text(family = "URWGothic",size = 80),

plot.subtitle = element_text(family = "URWGothic",size = 30),

plot.caption = element_text(family = "URWGothic",size = 30),

plot.margin = unit(c(1,1,1,1), "cm"),

panel.grid = element_blank()

)


795 views

©2020 by sportschord