[Rd] triax.points() from package plotrix

From: Andreas Plank <andreas.plank_at_web.de>
Date: Thu, 19 Jul 2007 16:07:50 +0200


Dear developers from package plotrix,

the function triax.points() from package plotrix does not draw any points, because of internal setting in triax.points() {points(..., type="l")}.
I add a new option in triax.points()

        point.type = "l",
So the user can choose which type of points should be drawn. May be other users already found this defect.

best whishes
Andreas Plank

####--- 8< ----#######
triax.points <- function (x,
  show.legend = FALSE,
  label.points = FALSE,
  point.labels = NULL,
  col.symbols = par("fg"),
  pch = par("pch"),
  bg.symbols = par("bg"),
  cc.axes = FALSE,
  point.type = "l", # new add
   ...
  )
{

    if (dev.cur() == 1)

        stop("Cannot add points unless the triax.frame has been drawn")     if (missing(x))

        stop("Usage: triax.points(x,...)\n\twhere x is a 3 column array of proportions or percentages")

    if (!is.matrix(x) && !is.data.frame(x))

        stop("x must be a matrix or data frame with at least 3 columns and one row.")

    if (any(x > 1) || any(x < 0)) {

        if (any(x < 0))
            stop("All proportions must be between zero and one.")
        if (any(x > 100))
            stop("All percentages must be between zero and 100.")
        x <- x/100

}

    if (any(abs(rowSums(x) - 1) > 0.01))

        warning("At least one set of proportions does not equal one.")     sin60 <- sin(pi/3)
    if (cc.axes) {

        ypos <- x[, 3] * sin60
        xpos <- x[, 1] + x[, 3] * 0.5

}

    else {
        ypos <- x[, 3] * sin60
        xpos <- 1 - (x[, 1] + x[, 3] * 0.5)

}

    nobs <- dim(x)[1]
    if (is.null(point.labels))

        point.labels <- rownames(x)
    if (label.points)

        thigmophobe.labels(xpos, ypos, point.labels)     if (show.legend) {

        legend(0.16 - 0.02 * max(nchar(point.labels)), 0.75 +
            0.04 * length(point.labels), legend = point.labels,
            pch = pch, col = col.symbols)

}

    points(x = xpos, y = ypos, pch = pch, col = col.symbols,

        bg = bg.symbols, type = point.type, ...)     invisible(list(x = xpos, y = ypos))
}



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sat 21 Jul 2007 - 08:57:15 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 21 Jul 2007 - 14:36:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.