Helmer Belbo
2009-Sep-14 20:43 UTC
[R] Legends dissapearing from scatterplot (car package) when using logarithmic axis
Dear R-people I am struggling with disappearing legend box when using logarithmic axis in scatterplot. Sample code: ############### library(car) #constructing data set x=rep(1:50, 2); ClassDummy=rep(1:2, each=50) ; y=5+ClassDummy+(rnorm(100,mean=(50/x),sd=(10/x))) mydata <- data.frame (cbind('x'=x, 'ClassDummy'=ClassDummy, 'y'=y)) mydata$Class<-rep(c('a', 'b'),each=50) # Plotting wiht regular axis scatterplot(y~x | Class, reg.line=FALSE, smooth=FALSE, labels=F, boxplots='xy', by.groups=FALSE, data=mydata ) #Plotting with logarithmic axes scatterplot(y~x | Class, reg.line=FALSE, log="xy", smooth=FALSE, labels=F, boxplots='xy', by.groups=FALSE, data=mydata ) ################### When using regular axis the legend box shows up. When using logarithmic axis the legend box does not show up.>From the R console i get the following error message:Warning message: In log(-0.0679588001734407, 10) : NaNs produced So; what is the problem here? How do I get the legend box when using logarithmic axis? System info: OS - Windows XP, R version 2.9.2, "car" package up to date by Sept. 14th 2009. Regards Helmer