R function and ...

From: Culhane, Aedin (a.culhane@ucc.ie)
Date: Mon Feb 16 2004 - 13:45:54 MET


Dear ADE4 developers,
In the next version of ADE4 for R, could you please edit s.label, s.class
and other graphics function to include the ... parameter.

This is very useful for passing graphics paramters through to plot. I've
been using this to pass a factor and different colours for different classes
to plot.

Also would it be possible to include the facility to turn off the placing of
labels in boxes.

The following seems to work in my hands:
scatterutil.eti<-function (x, y, label, clabel, boxes=TRUE)
{
    if (length(label) == 0)
        return(invisible())
    if (is.null(label))
        return(invisible())
    if (any(label == ""))
        return(invisible())
    for (i in 1:(length(x))) {
                cha <- as.character(label[i])
                cha <- paste(" ", cha, " ", sep = "")
                cex0 <- par("cex") * clabel
                x1 <- x[i]
                y1 <- y[i]
        

                if (boxes) {
                        xh <- strwidth(cha, cex = cex0)
                        yh <- strheight(cha, cex = cex0) * 5/3
                               rect(x1 - xh/2, y1 - yh/2, x1 + xh/2, y1 + yh/2, col
= "white",
                            border = 1)
                        }
                text(x1, y1, cha, cex = cex0)
                }

and I call scatterutil.eti(coox, cooy, label, clabel,...) from within
s.class and s.label.

Thanks a million
Aedin



This archive was generated by hypermail 2b30 : Tue Sep 07 2004 - 13:30:56 MEST