Skip to Main Content
Graphing Data with R
book

Graphing Data with R

by John Jay Hilfiger
October 2015
Beginner to intermediate content levelBeginner to intermediate
250 pages
6h 26m
English
O'Reilly Media, Inc.
Content preview from Graphing Data with R

Chapter 2. An Overview of R Graphics

This chapter discusses how to export a graph and the differences between exploratory and presentation graphs. There is also a brief overview of several graphics systems in R. If you have some past programming experience or substantial experience with graphics, you will probably appreciate having this information before going on to the specifics of R graph types. If you’re not coming from that background, you might find this material a little too technical and unnecessary at this point. If so, go directly to Chapter 3 and come back to this one when you are ready for it.

Exporting a Graph

After you have made a graph, you will probably want to save it or put it in a document. How you do this will depend on what other software you are using. With some word processors, for instance, you can simply copy the graph by opening the graph window in R and clicking Copy in the Edit menu or a context menu connected to the graph. You can then paste it into the word processor.

Other software will require a little more effort on your part. If you have tried the copy-and-paste method and it does not work, you will need to choose a file type and instruct R to save your graph in this format, to a specific file. You can save the graph in any one of several formats, including .bmp, .pdf, .jpeg, .png, .tiff, .ps (PostScript), and others. The code example that follows shows how to save the graph we made in “Exercise 1-1.” to a .jpeg file, named test.jpeg (you could, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

A Course in Statistics with R

A Course in Statistics with R

Prabhanjan N. Tattar, Suresh Ramaiah, B. G. Manjunath

Publisher Resources

ISBN: 9781491922606Errata Page