library(tidyverse)
library(palmerpenguins)
library(ggimage)
library(extrafont)
font_import()
Importing fonts may take a few minutes, depending on the number of fonts and the speed of the system.
Continue? [y/n]
loadfonts(device = "win")
Pick some part of the data to communicate about, as you would in a paper or presentation. Make at least one communicative visualization and be prepared to share it in-class.
library(tidyverse)
library(palmerpenguins)
library(ggimage)
library(extrafont)
font_import()
Importing fonts may take a few minutes, depending on the number of fonts and the speed of the system.
Continue? [y/n]
loadfonts(device = "win")
|>
penguins mutate(image = case_when(
== "Adelie" ~ "https://images2.imgbox.com/e7/b8/p5PaM2OS_o.png",
species == "Chinstrap" ~ "https://images2.imgbox.com/1a/bc/OKefZBKI_o.png",
species == "Gentoo" ~ "https://images2.imgbox.com/86/89/Zm2fJwTA_o.png"
species |>
)) ggplot(aes(x = flipper_length_mm, y = body_mass_g)) +
# geom_point(aes(color = species,
# shape = species),
# size = 2) +
# scale_color_manual(values = c("darkorange","darkorchid","cyan4"))+
geom_image(aes(image=image), size=.075, alpha = 0.75)+
facet_grid(.~species)+
theme_minimal()+
xlab("Flipper length in mm")+
ylab("Body mass in grams")+
ggtitle("Three pinguin species",
"Gentoo are big boys")+
labs(caption = "Data: Horst AM, Hill AP, Gorman KB (2020). \n palmerpenguins: Palmer Archipelago (Antarctica) penguin data.")+
xlim(170, 240)+
theme(text=element_text(size=16, family="Comic Sans MS"))
Warning: Removed 2 rows containing missing values (`geom_image()`).
ggsave(width = 16, height = 10, scale = 1, filename = "pinguins_vvseva.jpg")
Warning: Removed 2 rows containing missing values (`geom_image()`).
citation("palmerpenguins")
To cite palmerpenguins in publications use:
Horst AM, Hill AP, Gorman KB (2020). palmerpenguins: Palmer
Archipelago (Antarctica) penguin data. R package version 0.1.0.
https://allisonhorst.github.io/palmerpenguins/. doi:
10.5281/zenodo.3960218.
A BibTeX entry for LaTeX users is
@Manual{,
title = {palmerpenguins: Palmer Archipelago (Antarctica) penguin data},
author = {Allison Marie Horst and Alison Presmanes Hill and Kristen B Gorman},
year = {2020},
note = {R package version 0.1.0},
doi = {10.5281/zenodo.3960218},
url = {https://allisonhorst.github.io/palmerpenguins/},
}