Skip to content

Plots without X11 in CentOS

4 messages · Sudip Chatterjee, Peter Dalgaard

#
Hi All,

 I am wondering how to save plots in R at CentOS when X11 is not available,
any suggestion would be appreciated.

 Warm Regards
 Sudip
#
Plot directly to the appropriate device, e.g. 

pdf(file="my.pdf")
plot(rnorm(500))
dev.off()

This is often recommendable even if you do have an on-screen graphics device because some subtleties can get lost in translation for one device to another. (The prototypical example is that a legend box is sized to hold the text in the font used on the screen device. Then, saving to PDF causes the box to be scaled and the font to change, but it can happen that the text now overruns the box extents.)

Peter D.
On 24 Apr 2015, at 16:12 , Sudip Chatterjee <sudipanalyst at gmail.com> wrote:

            

  
    
#
Hi Peter,

 I did the same but I received an error stating X11 is not available.
On Fri, Apr 24, 2015 at 8:11 PM, peter dalgaard <pdalgd at gmail.com> wrote:

            

  
  
#
Hm?? Did something change while I wasn't looking? I'd expect PDF to be handled by the postscript driver and be independent of X11. 

Could you show a transcript of exactly what you did? Maybe include capabilities() and value of dev.cur() just before plotting.

-pd