There are several commands which will direct output to a file instead of the screen. You must use the dev.off() command to tell R that you are finished plotting, otherwise your graph will not show up. PDF is a vector file format. Vector files are generally preferred for print output because the resulting output can be scaled to any size without pixelation. The size of a vector file is usually smaller than the corresponding bitmap file, except in cases where there are many objects. (For example, a scatter plot with thousands of points may result in a very large vector file, but a smaller bitmap file.) If you want to edit your file in a vector editor like Inkscape or Illustrator, some of the plotting point objects might look like letters instead of circles, squares, etc. To avoid this problem: SVG is another vector format. The default settings for svg() doesn’t allow for multiple pages in a single file, since most SVG viewers can’t handle multi-page SVG files. See the PNG section below for outputting to multiple files. Increasing the resolution will increase the size (in pixels) of the text and graph elements. This occurs because the size of these elements is relative to the physical dimension of the graph (e.g., 4×4 inches), not the pixel dimension of the graph. For example, a 12 point font is 12/72 = 1/6 inch tall, at 72 dpi, this is 12 pixels, but at 120dpi, it is 20 pixels. If you want to make more than one graph, you must either execute a new png() command for each one, or put %d in the filename: Some programs which cannot import PDF files may work with high-resolution PNG or TIFF files. For example, Microsoft Office cannot import PDF files. For print publications, you may be required to use 300dpi images. If you make plots with ggplot2 in a script or function, you must use the print() command to make the graphs actually get rendered. This will save an exact pixel-for-pixel copy of what’s on screen, but it will probably only work in Linux and on Macs that use X11 for R graphing: This will save the current graph from the screen, but it re-renders it for the device, which may have different dimensions, so it won’t look exactly the same unless you specify the exact same size in pixels. Source.