Notes: setting up my R environment by loading ‘ggplot2’ and ‘palmer penguins’ packages
library(tidyverse)
library(palmerpenguins)
Here, we will go through a series of visualizations
Here, we plot flipper length against body mass
ggplot(data=penguins,aes(x=flipper_length_mm, y=body_mass_g))+
geom_point(color="purple")
## Warning: Removed 2 rows containing missing values (`geom_point()`).
Here, we plot flipper length against body mass and look at the breakdown by species
ggplot(data=penguins,aes(x=flipper_length_mm, y=body_mass_g))+
geom_point(aes(shape=species))
## Warning: Removed 2 rows containing missing values (`geom_point()`).
Here, we plot flipper length against body mass and look at the breakdown by species and sex
ggplot(data=penguins,aes(x=flipper_length_mm, y=body_mass_g))+
geom_point(aes(color=species, shape=species)) +
facet_wrap(~sex)
## Warning: Removed 2 rows containing missing values (`geom_point()`).
Here, we plot body mass against flipper length and look the final result of the largest species among Adelie, Chinstrap and Gentoo
ggplot(data=penguins)+
geom_point(mapping=aes(x=flipper_length_mm, y=body_mass_g, color=species, shape=species))+
labs(title="Palmer Penguins: Body Mass Vs Flipper Length", subtitle="Sample of Three Penguin Species",
caption="Data Collected by Dr. Kristen Gorman")+
annotate("text", x=220,y=3500,label="The Gentoos are the Largest", color="purple",
fontface="bold", size=4,angle=25)
## Warning: Removed 2 rows containing missing values (`geom_point()`).