Another way to transfer plots is to transfer the display list.
This is a list of the low level plot commands that R produces.
For example, on Linux do this:
dev.control(displaylist="enable") # enable display list
plot(1:10)
myplot <- recordPlot() # load displaylist into variable
save(myplot, file="myplot", ascii=TRUE)
Send the ascii file, myplot, to the Windows machine and on Windows do this:
dev.control(displaylist="enable") # enable display list
load("myplot")
myplot # displays the plot
savePlot("myplot", type="wmf") # saves current plot as wmf
I don't have Linux to actually try this out but perhaps someone
with both can try it out.
---
Date: Sun, 22 Feb 2004 21:13:37 +0530
From: Ajay Shah <ajayshah at mayin.org>
To: <r-help at stat.math.ethz.ch>
Subject: Re: [R] R: Including R plots in a Microsoft Word document
It was pointed out that while
win.metafile("/myfile.wmf")
is useful, it only works on windows.
Here's a path which would work on Unix:
1) Write an xfig file using R. I use something like :
xfig(file="created.fig", onefile=TRUE, bg="LightSkyBlue", width=5, height=3)
plot()
This is a very smart path to take if you want to manually touch up
the picture in xfig (leave aside the Windows problem).
2) The program fig2dev converts .fig files into many file formats,
including one "cgm" which is reputed to feed well into Microsoft
software. I have no Windows here, however, and can't try this out.
Now for a (perhaps trivial) question: Several people said you have to
do
win.metafile("/myfile.wmf")
plot(1:10)
dev.off() <-------- this is essential
Why is the 3rd line essential? I have been feeding R programs into R
using the command
$ R --vanilla < file.R
and I find things work just fine without having a dev.off()
command. E.g. I have this program which seems to work fine:
A <- read.table(
file="datafile.2",
na.strings=".",
col.names=c("date","dlinrchf","dlusdchf","dljpychf","dldemchf")
)
xfig(file="created.fig", onefile=TRUE, bg="LightSkyBlue", width=5, height=3)
plot(A$dlusdchf, A$dlinrchf,
xlab="USD/CHF returns",
ylab="INR/CHF returns",
col = "dark red")
-ans.