Julie,
Diane's suggestion works especially if you have run the pdf() command after
your plot() command. You can also run it before, but then you need to write
dev.off() *after* the plot command in order to "close" the device and open
the resulting file.
Here is an example using the postscript() command and a histogram command
we've seen on the list already:
postscript(file="foo.eps", onefile=FALSE, horizontal=FALSE, height=6,
width=6, pointsize=6)
par(mfrow=c(5,5))
for (i in 1:25) {
hist(mat[,i])
}
dev.off()
The advantage of postscript() is that it gives you an EPS file, which is
LaTeX's preferred graphic format (if you're using something else, then that
obviously isn't an issue). Why are the "onefile" and "horizontal"
options in
there? Don't ask me; many guides say to include them, and who am I to say
different?
Best,
John-Paul Ferguson
On Tue, Feb 10, 2009 at 4:33 PM, Julie K. Rajaratnam <
jrajarat at u.washington.edu> wrote:
Hi everyone,
I am a distance education student in this class, way out here in Seattle.
Very excited to be a part of the class and I am learning a lot from
everyone's questions.
One question which I haven't seen yet, and I didn't see in the section code
from last week is how to Print or Save your graphs. I have found the pdf()
command, but for some reason I can't get it to work. First I put the command
after my graph code, and a .pdf file was created, but 0 kb in size and I
couldn't open it. Then I put the pdf() command before my graph code, and I
am getting closer. Now a .pdf file is created that is 35kb in size, but I
still can't open it. I suspect it has the data in it, but why can't I access
it? Is there a command I need to use to close the file in R?
Second question ? this wasn't asked in the first lecture (presumably
because you all would not have been able to see us raise our hands) but I'm
curious ? how many E2001 students are currently in the class who are not in
the New England area? I know of at least two ? myself and one of my
coworkers. Anyone else out there in cyberclass? What is your geographic
location?
Thanks for the help (and satisfying my curiosity),
Julie Rajaratnam
Julie Knoll Rajaratnam, PhD
Research Scientist
Institute for Health Metrics and Evaluation
Phone: 206-897-2831
Email: jrajarat at
u.washington.edu
_______________________________________________
gov2001-l mailing list
gov2001-l at
lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l