Skip to content

stripchart() labels

3 messages · John Maindonald, Paul Murrell, Ross Ihaka

#
I propose to replace add a ... argument to stripchart(),
and to modiffy the following code fragment as shown.
[The only changes are the addition of ... arguments
in two calls to axis()]

plot(xlim, ylim, type = "n", ann = FALSE, axes = FALSE)
     box()
     if (vertical) {
         if (n > 1)
             axis(1, at = 1:n, lab = names(groups), ...)  # ... argument added
         axis(2)
     }
     else {
         axis(1)
         if (n > 1)
             axis(2, at = 1:n, lab = names(groups), ...)  # ... argument added
     }

Then one can do the following:
   data(PlantGrowth)
   attach(PlantGrowth)
   stripchart(weight~group, las=2)

or
   stripchart(weight~group, vertical=TRUE, las=2)

This is often the most effective way to deal with the problem
of overlapping labels, so that some labels do not appear.
John Maindonald               email : john.maindonald@anu.edu.au
Statistical Consulting Unit,  phone : (6125)3473
c/o CMA, SMS,                 fax   : (6125)5549
John Dedman Mathematical Sciences Building
Australian National University
Canberra ACT 0200
Australia

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Hi
added
added
We should probably also pass the "..." to the call(s) to points() so that
you could do things like ...

    stripchart(weight~group, pch=21, col="blue", bg="lightblue")

... and "..." should probably get passed to the call to title() too.

Paul


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Paul Murrell wrote:
I'd like to suggest a slightly different way of doing this.
There should be a ... in the outer function, but it should be used as
follows.

	outerfun <- function(x, y, ...) {
		pars <- list(...)
		...
		points(x, y, pch = pars$pch, col = pars$col)
		...
		title(main = pars$main, xlab = pars$xlab)
	}

This allows to be explicit about which parameter values get dispatched
to which
graphics functions.