Saving and Exporting Graphics
Learn how to save plots to different formats for reports or presentations.
Saving and Exporting Graphics is a free R Academy lesson on CoddyKit. This is lesson 3 of 3. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the R Academy learning path, and your progress syncs across the web and the CoddyKit app. The R Academy course includes 3 lessons in total.
Introduction to Saving and Exporting Graphics
Saving your plots is essential for sharing and documentation. In this lesson, you'll learn how to save and export plots in different formats.

Saving Plots as PNG
The png() function allows you to save plots as PNG files.
png('my_plot.png')
plot(1:10)
dev.off()Saving Plots as PDF
You can save plots as PDF files using the pdf() function.
pdf('my_plot.pdf')
plot(1:10)
dev.off()Saving Plots as JPEG
The jpeg() function allows saving plots in JPEG format.
jpeg('my_plot.jpeg')
plot(1:10)
dev.off()Saving Plots as SVG
SVG format is useful for scalable vector graphics.
svg('my_plot.svg')
plot(1:10)
dev.off()Saving Multiple Plots
You can save multiple plots in a single PDF file.
pdf('multiple_plots.pdf')
plot(1:10)
plot(10:1)
dev.off()Adjusting Plot Size
You can specify the dimensions of the exported file using width and height parameters.
png('wide_plot.png', width=800, height=400)
plot(1:10)
dev.off()Saving ggplot2 Plots
The ggsave() function is used to save ggplot2 plots.
library(ggplot2)
p <- ggplot(mtcars, aes(x=mpg, y=hp)) + geom_point()
ggsave('ggplot.png', plot=p)Saving Graphics Recap
Summary
In this lesson, you learned:
- How to save plots in different formats (PNG, PDF, JPEG, SVG).
- How to save multiple plots in a single file.
- How to adjust plot sizes before exporting.

Learn R with an AI tutor — free
Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.
- Courses
- 43
- Lessons
- 159
Frequently Asked Questions
Is the “Saving and Exporting Graphics” lesson free?
Yes — any 3 lessons of the R Academy learning path, including “Saving and Exporting Graphics”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The R Academy course includes 3 lessons in total.
What will I learn in “Saving and Exporting Graphics”?
Learn how to save plots to different formats for reports or presentations. You practise R Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start R Academy?
No prior experience is required. R Academy on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 3 of 3.
How long does the “Saving and Exporting Graphics” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this R Academy lesson?
Yes. Every R Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Basic Plots in R
- Customization of Plots
- Saving and Exporting Graphics