3  画图

The penguins data contains size measurements for penguins from three islands in the Palmer Archipelago, Antarctica.

The three species of penguins have quite distinct distributions of physical dimensions (图 3.1).

library(tidyverse, quietly = TRUE)
library(palmerpenguins)

penguins |>
  ggplot(aes(x = flipper_length_mm, y = bill_length_mm)) +
  geom_point(aes(color = species)) +
  scale_color_manual(
    values = c("darkorange", "purple", "cyan4")) +
  theme_minimal()
图 3.1: Dimensions of penguins across three species.

这是另外一个例子(图 3.2):

library(ggplot2)

ggplot(airquality, aes(Temp, Ozone)) + 
  geom_point() + 
  geom_smooth(method = "loess")
图 3.2: Temperature and ozone level.