How to Use ggsave() to Export a Plot in R - Demonstration
Channel: Monika Wahi
Date: 2022-04-16

*Note: I may be compensated, but you will not be charged, if you click on the links below.

In this video, Monika Wahi shows you how to use the ggsave() command to export a box plot she made in ggplot2 in R GUI. See her blog post with other videos on box plots here: https://buff.ly/3uK49fN 
Files on Github: https://buff.ly/3xF6H27
Data from American Hospital Directory: https://www.ahd.com/ 
More about ggsave: https://ggplot2.tidyverse.org/reference/ggsave.html 
Box plot blog post with more information: https://buff.ly/3uK49fN 
Video where we make the base box plot: https://youtu.be/hni3D1LE6qo 
Recording of livestream demonstration: https://youtu.be/ZSFixsjy0Kw 

Want free advice from Monika? Register for a free 30-minute consultation on Zoom: https://calendly.com/dethwench/30-minute-free-consultation 

Want an exciting educational opportunity? Join Monika’s upcoming online workshop, “Application Basics”: https://dethwench.com/applications-basics-for-data-analysts-and-statisticians/  

For great data science resources, follow the company page for Monika’s company, DPS: https://www.linkedin.com/company/dethwench-professional-services/

To be notified of new learning resources, register for Monika’s mailing list: https://mailchi.mp/7308544d4fa7/sign-up-for-weekly-data-science-digest

💙Follow Monika’s blog: https://dethwench.com/blog/ 
💚Subscribe to Monika’s YouTube channel: https://www.youtube.com/channel/UCCHcm7rOjf7Ruf2GA2Qnxow 
💜Follow Monika on X: https://twitter.com/dethwench 
🤍Follow Monika on Instagram: https://www.instagram.com/dethwench/
🤎Get code from Monika’s GitHub: https://github.com/DethWench 
💛Follow Monika on Mastodon: https://fosstodon.org/@dethwench 
🖤Follow Monika on Quora: https://publichealthdatascience.quora.com/

Timestamps and links as the come up are below:
00:29 Explanation of the problem that ggsave() solves
00:49 Introduction to the base code we are using to create the plot we are saving
01:08 Description of the base dataframe we are using for the plot
02:22 How this plot will be used to demonstrate ggsave() in this video
02:45 Running base box plot code – modified to save the plot as an object named boxplot_figure
04:00 Explanation of the problem of the default dimensions of the plot object
04:10 Menu-driven approach for manually saving the plot from current R GUI session
04:30 How to manipulate the size of the plot manually in R GUI and save it
05:25 Introduction to ggsave() code
05:32 First argument: name of file to save
05:54 Next argument: specify units
06:14 Next arguments: specifying dimensions
06:34 Next argument: specify dots per inch (dpi)
06:43 Next argument: name of plot object
07:06 Running ggsave() code, and locating the exported plot in the working director
07:35 What the box plot object saved as a *.png with specified dimensions looks like

How to Use ggsave() to Export a Plot in R - Demonstration