Get startedGet started for free

Point charts

1. Point charts

In the last lesson we discussed situations where a bar chart may not be ideal, but we never actually talked about any alternatives for those situations. In this lesson, we will do just that.

2. When a bar chart isn't ideal

As mentioned, not every example of point data is a quantity that works for a barchart. Some common types of data that aren't stackable are percentiles, ratios, or sensor readings like temperature. ... Another example of where a bar chart doesn't make sense is with any non-linear transformation such as the log, square root, or exponentiation. This is because depending upon where they fall on the transformation curve, one transformed unit equals a different number of un-transformed units.

3. Point charts

The solution to dealing with the perception issues encountered with a bar is to simply replace the bars with a point that sits right where the top of the bar would sit. This is commonly called a point or dot chart. Simple, right?

4. Benefits of point charts

With a point chart, you have the same high precision representation that bars give you without any biases about the values falling 'below' the measurement. Point charts also can fit more classes before degrading in legibility than a bar simply due to the smaller space requirements of dots. Last, they are simple. A dot at the point on the axis corresponding to your observation. Minimal and intuitive.

5. Data for lesson

Briefly, before we get into plotting code, in this lesson we will be dealing with a subset of the WHO data. Here I have singled out a couple countries from each region that have interesting patterns in their data and subset them to look at just measles for the years 2006 and 2016.

6. who_subset

In printing the new data frame we can see that we now have two columns corresponding to cases, one for the year 2006 and one for 2016, and as a result, no year column. Otherwise everything is the same.

7. Code for point charts

Making a point chart in ggplot is un-surprisingly easy. The point geometry just takes our desired aesthetic mappings and draws a point for each observation. Here we are looking at the log of cases for 2016 by country.

8. Code for point charts

This plot instantly shows us the highest country is Nigeria with around 10 to the 4 and a half cases of measles in 2016. The lowest is Tanzania with 10 to the one point five. This plot is a little hard to read due to the relatively random y positions of the points and the lack of solid anchors back to their corresponding countries, but a there is a simple fix for this - ordering.

9. Ordering your point charts

The easiest way to order your point chart, like we did with the bars, is the reorder function applied directly within your aes function call. ... Here's a more complex example looking at the log base two-fold change of cases from 2006 to 2016. A log fold change of 1 is interpreted as a doubling value, 2: a quadrupling, and so on. So, while we are dealing with counts here, we're looking at a metric that violates the basic assumption of a bar chart and therefore we use a point chart.

10. Ordering your point charts

Notice how much easier the chart is to read and pick out a story from when we've ordered it. We can rapidly make comparisons between similar countries and see the biggest positive and negative changes. However, if your data has some sort of structure in the categories, such as years, you probably don't want to reorder based on the numeric axis.

11. Let's practice!

Let's explore explore a different subset of our data with point-charts.