Hi,
 
Thank you both for the suggestions .... it seems i have to send the plot twice 
since i cannot have 2 devices active in the same time ..... I Knew about 
savePlot but this saves jpf only at 72 dpi and i wanted a better resolution for 
jpg files. I will look into dev.copy2pdf, maybe i can have the jpg device open, 
save the plot there and after use dev.copy2pdf to get my pdf.
 
Again, thanks,
 
Monica> From: [EMAIL PROTECTED]> To: [EMAIL PROTECTED]; r-help@r-project.org> 
Date: Tue, 22 Jul 2008 09:15:51 -0600> Subject: RE: [R] saving plot both as jpg 
and pdf> > Plotting functions only send the plot to the current device (in your 
case the 2nd one opened). You can see all the currently open devices with 
dev.list, you can see which is current with dev.cur, you can change which is 
current using dev.set (and possibly dev.next and dev.prev). Look at the help on 
these functions.> > To get copies of the same graph in both devices you need to 
either:> > 1. plot the graph in the current device> 2. switch devices> 3. issue 
the same plot command in the now current device> > Or:> > 1. plot the graph in 
the current device> 2. use dev.copy (or related functions) to copy the current 
graph to another device> > Note that the 2nd only works when recording is 
turned on (which is not the default for jpeg or pdf).> Also, the 2 methods may 
result in small differences between the gr!
 aphs based on which sets of defaults are used.> > Another option is to use the 
dev.copy2pdf function to create the pdf file without opening a pdf device 
yourself.> > Hope this helps,> > --> Gregory (Greg) L. Snow Ph.D.> Statistical 
Data Center> Intermountain Healthcare> [EMAIL PROTECTED]> (801) 408-8111> > > > 
> -----Original Message-----> > From: [EMAIL PROTECTED]> > [mailto:[EMAIL 
PROTECTED] On Behalf Of Monica Pisica> > Sent: Tuesday, July 22, 2008 7:50 AM> 
> To: r-help@r-project.org> > Subject: [R] saving plot both as jpg and pdf> > 
Importance: High> >> >> > Hi,> >> > I want to save a plot automatically as a 
pdf and jpg, and if> > I open the pdf device first and jpeg second only the 
jpeg> > file saves correctly .... If I do reverse, only the pdf file> > saves 
correctly.> >> > pdf('E:/my_graphs/test1.pdf', bg = "white")> > 
jpeg('E:/my_graphs/test1.jpg', quality = 100, bg = "white",> > res = 200, width 
= 7, height = 7, units = "in") plot(seq(1,> >!
  10), seq(1, 10))> > dev.off()> > dev.off()> >> > In this case the pdf
 is not saved correctly and cannot be> > viewed by Adobe - the error is "it has 
no pages". If the jpeg> > device is first open .... It will save an empty page. 
Of course> > I can open one device at a time have the plot saved and close> > 
that device, and open it again and do same thing, but I think> > I should be 
able to have the plot command only once. I am> > working on a Windows machine, 
R.2.7.0.> >> > Any suggestions will be very much appreciated.> >> > Thanks,> >> 
> Monica> >> >> > 
_________________________________________________________________> >> >> > 
enger2_072008> > ______________________________________________> > 
R-help@r-project.org mailing list> > 
https://stat.ethz.ch/mailman/listinfo/r-help> > PLEASE do read the posting 
guide> > http://www.R-project.org/posting-guide.html> > and provide commented, 
minimal, self-contained, reproducible code.> >> 
_________________________________________________________________



        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to