Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Empty plot in R

Tags:

linux

r

I did a fresh install of ARCH linux and so of R version 2.15.1. But after plotting anything with the plot command, the plot window is always empty (nothing shown). Could there be an issue with drivers or something else. I have tried graphics.off() function but to no avail.

Question edited:

The plot however is visible after resizing the plot window.

x<-c(1, 2, 3, 4, 5)
y<-c(0.1, 0.3, 0.7, 1.11, 1.3) 
plot(x, y) 

> sessionInfo() 
R version 2.15.1 (2012-06-22) 
Platform: x86_64-unknown-linux-gnu (64-bit) 
locale: 
[1] C 

attached base packages: 
[1] stats graphics grDevices utils datasets methods base

Question edited:

Setting X11.options(type="nbcairo") works fine.

like image 885
Shahzad Avatar asked Nov 05 '12 15:11

Shahzad


1 Answers

Sometimes you need to execute an initial plot.new() or dev.new() to initialize the graphics device. That is supposed to be happening with plot.default() which is the function that would have been called when you gave plot two vectors.

There are options that can affect the graphics device call. Use names(options()) to see the vector of names of the options list. My system is set up so options()$device sets up the quartz device defaults properly. This is an option that is defined when the grDevices package is loaded. See:

?options   # in the grDevices section.

Using ARCH-Linux means you are going down a "less traveled path". There are many more experienced users of Debian (and Debian derived variants like Ubuntu) and RH Linuxen installations. I did find two postings to r-devel from persons using ARCH Linux, so that doesn't suggest widespread knowledge. You might be better off posting to the r-devel mailing list, now that you have behavior that shows there is interactive graphics driver capability, but just a glitch in the initial 'draw' functionality.

like image 74
IRTFM Avatar answered Oct 11 '22 23:10

IRTFM