Introduction to Statistics (MAT/SST 115.03 2008S)
Primary: [Front Door] [Syllabus] [Current Outline] [R] - [Academic Honesty] [Instructions]
Groupings: [Applets] [Assignments] [Data] [Examples] [Handouts] [Labs] [Outlines] [Projects] [Readings] [Solutions]
External Links: [R Front Door] [SamR's Front Door]
At times, you will find it useful to save the graphs you create,
so that you can print them
or copy them to other applications. You begin by creating the
graph as you normally would. Then, you use a series of arcane
commands to build the file. The most important of these commands
is , which copies the
graph to a file. You specify the type of file (usually
dev.copyjpeg), the file name, and the width and height.
When you are done, you follow the
command with
dev.copydev.off().
For example, the following saves the current image to the file
graph.jpg on your desktop.
dev.copy(jpeg, filename="~/Desktop/graph.jpg", width=400, height=400) dev.off()
You can also save to PostScript and a wide variety of other formats, although some of the commands are a bit different. For example, here's are commands to save the graph as PostScript and PDF.
dev.copy(postscript, "~/Desktop/graph.ps") dev.copy(pdf, "~/Desktop/graph.pdf")
You may find that you have to play a bit to get the output laid out the way you want.
Once you have a file that you like, you can email it to yourself for including in an electronic document or print it for attaching to a physical document.
Primary: [Front Door] [Syllabus] [Current Outline] [R] - [Academic Honesty] [Instructions]
Groupings: [Applets] [Assignments] [Data] [Examples] [Handouts] [Labs] [Outlines] [Projects] [Readings] [Solutions]
External Links: [R Front Door] [SamR's Front Door]
Copyright (c) 2007-8 Samuel A. Rebelsky.
This work is licensed under a Creative Commons
Attribution-NonCommercial 2.5 License. To view a copy of this
license, visit http://creativecommons.org/licenses/by-nc/2.5/
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.