Saving Your Plots

ggsave() lets you get your plots out of R for sharing.

ggplot(penguins, aes(x = flipper_length_mm, y = body_mass_g)) +
  geom_point()
ggsave(filename = "penguin-plot.png", width = 800, units = "px")
#> Saving 800 x 1983 px image
#> Warning message:
#> Removed 2 rows containing missing values (`geom_point()`). 

Setting width and/or height helps with reproducibility.