[R] unexpected behavior in plot

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Mar 30 18:29:45 CEST 2004


Arditi, Aries wrote:
> I'm having difficulty getting plot to work with type="n", when either the x or y variables is a factor.
> 
> For example,
> 
> x <- 1:10
> y <- 1:10
> 
> plot(x, as.factor(y), type="n")
> plot(as.factor(x),y, type="n")
> plot(y ~ as.factor(x), type="n")
> 
> produce plots with data plotted, whereas
> 
> plot(x,y, type="n") 
> plot(y ~ x, type = "n")
> 
> produce the expected dataless plots
> 
> I am running R1.8.1 on Windows (xp), with the windows graphics device.
> 
> I have a friend who has tried this on a Mac (OS 10.3.3. with quartz() and x11() devices) and gets erratic behavior, i.e. sometimes plots works as expected, and sometimes not.
> 
> Does anyone have any clues on this?


Yes: If x is a factor, boxplot() is called by plot.factor(), the 
corresponding method for the generic plot().
boxplot() does not care about type="n".

Uwe Ligges



> Thanks in advance,
> 
> 
> Aries Arditi, Ph.D.
> Senior Fellow in Vision Science
> Arlene R. Gordon Research Institute
> Lighthouse International
> 111 East 59th Street
> New York, NY 10022
> 
> Tel: +1 212 821 9500 (direct)
> Fax: +1 212 751 9667
> http://www.lighthouse.org/research_staff_arditi.htm
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list