[Rd] triax.points() from package plotrix

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Jul 21 15:08:14 CEST 2007


Remarks, bug reports and feature requests on contributed packages should 
go to the corresponding package maintainer (CCing). Note that several 
developers of the > 1000 CRAN R packages do not read this mailing list.

Thank you,
Uwe Ligges



Andreas Plank wrote:
> 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



More information about the R-devel mailing list