Practicing Plotting with Penguins Dataset

Environment Setup

Loaded packages for the Palmer Penguins dataset and GGPlot2

library(palmerpenguins)
library(ggplot2)

Dataframe preview

Used the View function to see Penguins dataset in a new tab

View(penguins)

Code for plot 1

ggplot(data = penguins, aes(x=body_mass_g, y=species)) +
  geom_line(size = 5, color = "red", fill = "yellow") +
  labs(title = "Penguin Body Mass Readings") +
  theme(plot.title = element_text(hjust = 0.5, face = "bold", color = "#1F6", size = 15)) +
  theme(text = element_text(vjust = 0.5, face = "bold", color = "#1F6", size = 12))
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning in geom_line(size = 5, color = "red", fill = "yellow"): Ignoring
## unknown parameters: `fill`
## Warning: Removed 2 rows containing missing values or values outside the scale range
## (`geom_line()`).

Code for plot 2

ggplot(data = penguins, aes(x = flipper_length_mm, y = body_mass_g)) +
  geom_point(aes(color = species)) +
  labs(title="Connections Between Flipper Length & Body Weight") +
  theme(plot.title = element_text(hjust = 0.5, face = "bold", color = "#00CEC8")) +
  theme(text = element_text(vjust = 0.5, face = "bold", color = "#00CEC8"))
## Warning: Removed 2 rows containing missing values or values outside the scale range
## (`geom_point()`).