0Pricing
R Academy · Lesson

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 — lesson 3 of 3. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the R Academy learning path, one of 3 lessons in the course, and your progress syncs across the web and the CoddyKit app.

1

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 and Exporting Graphics — illustration 1

2

Saving Plots as PNG

The png() function allows you to save plots as PNG files.

png('my_plot.png')
plot(1:10)
dev.off()

3

Saving Plots as PDF

You can save plots as PDF files using the pdf() function.

pdf('my_plot.pdf')
plot(1:10)
dev.off()

4

Saving Plots as JPEG

The jpeg() function allows saving plots in JPEG format.

jpeg('my_plot.jpeg')
plot(1:10)
dev.off()

5

Saving Plots as SVG

SVG format is useful for scalable vector graphics.

svg('my_plot.svg')
plot(1:10)
dev.off()

6

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()

7

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()

8

9

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)

10

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.
Saving and Exporting Graphics — illustration 10

Frequently asked questions

Is the “Saving and Exporting Graphics” lesson free?

Yes — the full text of “Saving and Exporting Graphics” is free to read here on the web, and the R Academy course includes 3 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the R Academy course, upgrade to CoddyKit PRO.

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; this is — lesson 3 of 3, so you can start here or from the beginning and move at your own pace.

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

  1. Basic Plots in R
  2. Customization of Plots
  3. Saving and Exporting Graphics
← Back to R Academy