From p.dalgaard@biostat.ku.dk  Tue Jan 30 15:32:30 2001
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 30 Jan 2001 16:32:30 +0100
Subject: [Rd] Disappearing x axis in plot.factor (PR#830)
In-Reply-To: tov@ece.cmu.edu's message of "Tue, 30 Jan 2001 06:27:11 +0100 (MET)"
References: <200101300527.GAA28423@pubhealth.ku.dk>
Message-ID: <x28znt5a41.fsf@blueberry.kubism.ku.dk>

tov@ece.cmu.edu writes:

> Hi.
> 
> While there is an x-axis set up for:
> > plot.factor(factor(1:3))
> 
> this axis is not present for
> > plot.factor(factor(1:3), col="red")
> 
> which actually should just be the same as the first plot and call
> barplot(table(.)), shouldn't it?  Where did the ticks and labels go?
> 
> Note that
> > barplot (table(factor(1:3)), col="red")
> has the x-axis.
> 
> Something funky is going on with axisnames or args in plot.factor that
> I can't figure out.  The situation can be remedied with
> > plot.factor(factor(1:3), col="red", axes=TRUE)
> 
> alas, why do you need "axes=TRUE"?

Because of the logic of

        axisnames <- if (length(dargs <- list(...)) > 0) {
            nam <- names(dargs)
            ((any("axes" == nam) && dargs$axes) || (any("xaxt" == 
                nam) && dargs$xaxt != "n"))
        }

gives FALSE if there are any "..." arguments, and neither of axes= and
xaxt= are given.

I think the first part of plot.factor wants to be 

     if (missing(y) || is.factor(y)) {
	dargs <- list(...)
        axisnames <- if (!is.null(dargs$axes)) dargs$axes
	    else if (!is.null(dargs$xaxt)) dargs$xaxt != "n"
            else TRUE
    }

Anyone know better?

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] Disappearing x axis in plot.factor (PR#830)
Peter Dalgaard BSA