Working with ggplot

packages

Using ggplot with the palmerpenguins package

Felicia Cruz true
08-10-2021
Show code
ggplot(data = penguins, aes(x= flipper_length_mm, y = body_mass_g)) +
  geom_point(aes(color = species)) + 
  labs(title = "Flipper Length and Body Mass by Species",
       subtitle = "Palmer Penguins",
       x = "Flipper Length (mm)",
       y = "Body Mass (g)",
       color = "Species") +
  theme_gray()

This scatterplot shows a positive correlation between penguin flipper length and body mass. While the Adelie and Chinstrap species are similar in size, the Gentoos weigh a lot more and have much longer flippers.

Citation

For attribution, please cite this work as

Cruz (2021, Aug. 10). Felicia Cruz: Working with `ggplot`. Retrieved from https://fmcruz23.github.io/posts/2021-08-10-a-function-i-learned/

BibTeX citation

@misc{cruz2021working,
  author = {Cruz, Felicia},
  title = {Felicia Cruz: Working with `ggplot`},
  url = {https://fmcruz23.github.io/posts/2021-08-10-a-function-i-learned/},
  year = {2021}
}