[R] Problem plotting in R under linux (centos)

Roger Gill roger.gill1979 at yahoo.co.uk
Mon Jun 6 15:56:26 CEST 2011


Dear All,

I am running into a slightly odd issue when attempting to produce a png/pdf file 
in R under centos. The version of Centos is 5.6 with an old version of R  2.12.0 
(2010-10-15). My script is roughly:

mydata <- read.csv(myfile)

png(outfile)

plot(0,0,type='n',ylim=c(-500,500),xlim=c(0,700),xlab=...
lines(mydata$x,mydata$y)

dev.off()

It produces a plot  with the correct limits and labels but the lines command 
does not seem to always work (I have checked that the data fall within the 
defined limits!). No error message is reported. The data sets are reasonable 
large (~6.5 million lines) but not large enough to cause an issue? It runs fine 
on my windows machine albeit with the latest R build. 


If I loop over the data set plotting chunks at a time it works just fine.

n <- floor(nrow(mydata)/1000000)
for(i in 0:n){
  lines(mydata[max((i*1000000),1) : min(((i+1)*1000000),nrow(mydata)),])
}

I have googled and cant find anything helpful. Is it an issue with R, my R 
installation, Centos etc

Thanks in advance,

Roger



More information about the R-help mailing list