Skip to content
Prev 12607 / 398502 Next

boxplot question

On Fri, 27 Jul 2001, Marc Feldesman wrote:

            
Yes. In order to get around this you need to modify the bxp() function
that does the actual plotting.


My recommended change is to add a show.names argument:

  function (z, notch = FALSE, width = NULL, varwidth = FALSE, notch.frac =
  0.5,  boxwex = 0.8, border = par("fg"), col = NULL, log = "", pars =
  NULL, frame.plot = axes, horizontal = FALSE, add = FALSE, at = NULL,
  show.names=NULL, ...)

and then near the end of the function replace the if(axes) conditional
with

    if (axes) {
        ax.pars <- pars[names(pars) %in% c("xaxt", "yaxt", "las")]
	if(is.null(show.names)) show.names<-(n>1)
        if (show.names)
            do.call("axis", c(list(side = 1 + horizontal, at = at,
                labels = z$names), ax.pars))
        do.call("axis", c(list(side = 2 - horizontal), ax.pars))
    }


Now the standard behaviour is the same but you can override it with

  temp<-boxplot(y~g,plot=FALSE)
  bxp(temp,show.names=TRUE)

or if you have multiple groups but don't want names for some strange
reason
  bxp(temp,show.names=FALSE)


	-thomas

Thomas Lumley			Asst. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._