[R] Save figure in pdf

David Winsemius dwinsemius at comcast.net
Fri Aug 26 16:27:11 CEST 2011


On Aug 26, 2011, at 10:06 AM, Rainer M Krug wrote:

> On Fri, Aug 26, 2011 at 3:37 PM, R. Michael Weylandt <
> michael.weylandt at gmail.com> wrote:
>
>> I don't have the FactoMineR library so I can't replicate, but it  
>> seems that
>> your problem is that you never plot anything.
>>
>> Effectively, your code runs
>>
>> windows()
>> x = 1:5
>> x
>>
>> and then wondering where your graph is.
>>
>> Add plot(res.pca) and i think your problem will be solved.
>>
>
> Does the code produce a graph when used without the pdf()? If no,  
> there is a
> problem. If yes, try to say
>
> print(  res.pca )
>
> instead of res.pca as some graphs need to be printed to the device
> explicitely.

Agree that probably it and the OP might want to read the FAQ entry.

http://cran.r-project.org/doc/FAQ/R-FAQ.html

"Why do lattice/trellis graphics not work?"

>
> Cheers,
>
> Rainer
>
>> Michael Weylandt
>>
>> On Fri, Aug 26, 2011 at 9:21 AM, Komine <momadou at yahoo.fr> wrote:
>>
>>> Hi,
>>>
>>> I created a figure with R and I want to save it in .pdf. I used this
>> code:
>>>> pdf("res.pca.pdf",width=10,height=8)
>>>> library(FactoMineR)
>>>> res.pca<-PCA(acp)
>>>> res.pca
>>>> dev.off()
>>>
>>> When I go in my folder, I find an empty file ( 0 Ko).
>>> Do you know where is the problem.
>>>
>>> Thank you in advance
>


David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list