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

**Peter Dalgaard BSA
**
p.dalgaard@biostat.ku.dk

*30 Jan 2001 16:32:30 +0100*

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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._