Re: [R] saving plot both as jpg and pdf

From: Tomas Lanczos <lanczos_at_fns.uniba.sk>
Date: Tue, 22 Jul 2008 17:37:44 +0200

Just an advice: I recommend use the png device instead of jpeg for plotting purposes, it gives better results for graphs. Jpeg is better for photos. Off course IMHO :-)

I wish a nice day

Tomas

stephen sefick wrote:
> you have to go in sequence- you are opening a pdf device then a jpeg
> device
> and ploting to the jpeg device. My suggestion would be to do
> pdf()
> plot(yourplot)
> dev.off()
>
> jpeg
> plot(yourplot)
> dev.off()
>
> this should work
>
> On Tue, Jul 22, 2008 at 9:50 AM, Monica Pisica <pisicandru_at_hotmail.com>
> wrote:
>
>
>> 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_at_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.
>>
>>
>
>
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-help_at_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.
>



R-help_at_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. Received on Tue 22 Jul 2008 - 15:53:53 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 22 Jul 2008 - 16:31:53 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive