Scatterplots
Explore how to build scatterplots using the ggplot2 package in R's Tidyverse framework. Understand the components of the grammar of graphics, filter datasets for focused analysis, and interpret the relationships between numerical variables visually.
We'll cover the following...
We'll cover the following...
Needed packages
Let’s load all the packages needed for the upcoming programs:
library(nycflights13)library(ggplot2)library(dplyr)
Load packages
Five named graphs: The 5NG
In order to keep things simple in this course, we’ll only focus on five different types of graphics, each with a common given name. We term these the five named graphs, or in abbreviated form, the 5NG:
Scatterplots
Line graphs
Boxplots
Histograms
Barplots
Overview of scatterplots
The simplest of the 5NG are scatterplots, also called bivariate plots. They allow us to visualize the relationship ...