Visualizing your data is hands down the most important thing you can learn to do. There are links to additional resources at the end of this document for additional learning.
There are two audiences in mind when creating data visualizations:
- For your eyes only (FYEO). These are quick and dirty plots, without annotation. Meant to be looked at once or twice.
- To share with others. These need to completely stand on their own. Axes labels, titles, colors as needed, possibly captions.
You will see, and slowly learn, how to add these annotations and how to clean up your graphics to make them sharable.
ggplot2 already does a lot of this work for you.
We will also use the two most common methods used to create plots. 1) Base graphics, 2) the
ggplot2 package. Each have their own advantages and disadvantages. If you have not done so already, go ahead and install the
ggplot2 package now.
For almost every plot discussed we will create two types of plots
- FYEO - using base graphics. (Base == Comes with R) Very powerful, but can be technical.
- FYEO - using
ggplot2. Each have their own advantages and disadvantages.
As time permits I will update each section with a third type of plot -
- Sharable - Contains all bells and whistles needed to make it presentable to others.
Your task, should you choose to accept, is to follow along through this tutorial and at each step try to reproduce the plot shown. You can accomplish this by simply copying and pasting the syntax into a new R code (or R Markdown) document.