From ihaka@stat.auckland.ac.nz  Wed Jul 11 22:16:20 2001
From: ihaka@stat.auckland.ac.nz (Ross Ihaka)
Date: Thu, 12 Jul 2001 09:16:20 +1200
Subject: [Rd] stripchart() labels
References: <5.0.2.1.1.20010711091841.02233aa0@pophost.anu.edu.au> <027b01c109bf$8ff4e780$175dd882@stat.auckland.ac.nz>
Message-ID: <3B4CC224.45E6752A@stat.auckland.ac.nz>

Paul Murrell wrote:
> 
> Hi
> 
> > 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.
> 
> 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.

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.

-- 
Ross Ihaka                         Email:  ihaka@stat.auckland.ac.nz
Department of Statistics           Phone:  (64-9) 373-7599 x 5054
University of Auckland             Fax:    (64-9) 373-7018
Private Bag 92019, Auckland
New Zealand
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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] stripchart() labels
Ross Ihaka