---
layout: post
title: "Cleveland dot chart vs bar plot with R's ggplot2 (CC158)"
blurb: "Plotting the difference in intention"
author: "PD Schloss"
date: 2021-10-28 11:00
comments: false
youtube: Ndan-_POxaE
start_hash: e52b5e17cc0599ba02bebd259396494da4cd3032
end_hash: b309380a281cefd15d1a8c6f4ba6e2ea3c04398d
---

So which is better in the Cleveland dot chart vs bar plot battle of plots? A Cleveland dot chart is a simple way to represent continuous data against categorical data. It is a nice alternative to the traditional bar plot, which uses a lot of ink to convey little extra information. I'm going with the Cleveland dot chart. Regardless it is straightforward to go back and forth between the figures by chaging a single line of ggplot2 R code. The data depict the percentage of people in 15 countries who would be willing to receive the COVID-19 vaccine as of August and October of 2020.

In this episode, Pat uses `ggplot2` and `dplyr` to make a Cleveland dot chart and bar plot using `geom_point` and `geom_col`.


<iframe style="margin: 0 auto;display:block;" width="560" height="315" src="https://www.youtube.com/embed/{{ page.youtube }}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>


## Code

You can browse the state of the repository at the
* [beginning of the episode](https://github.com/riffomonas/vaccination_attitudes/tree/{{ page.start_hash }})
* [end of the episode](https://github.com/riffomonas/vaccination_attitudes/tree/{{ page.end_hash }})


### Data

The `august_october_2020.csv` data is available in the [GitHub repository](https://raw.githubusercontent.com/riffomonas/vaccination_attitudes/3f39b9e09618144874ced760c9a6332498e3a19c/august_october_2020.csv).

```
X.1,Total Agree - August 2020,Total Agree - October 2020
Total,77,73
India,87,87
China,97,85
South Korea,84,83
Brazil,88,81
Australia,88,79
United Kingdom,85,79
Mexico,75,78
Canada,76,76
Germany,67,69
Japan,75,69
South Africa,64,68
Italy,67,65
Spain,72,64
United States,67,64
France,59,54
```
