[R] How to scale arrows to approximately fill a plot region?
Mark Difford
mark_difford at yahoo.co.uk
Wed Dec 7 21:29:37 CET 2011
On Dec 07, 2011 at 10:20pm Michael Friendly asked:
> How to scale arrows to approximately fill a plot region?
Michael,
Following Uwe...If you want code that does it then look at what Daniel
Chessel did in package ade4:
##
> scatter.dudi
function (x, xax = 1, yax = 2, clab.row = 0.75, clab.col = 1,
permute = FALSE, posieig = "top", sub = NULL, ...)
{
if (!inherits(x, "dudi"))
stop("Object of class 'dudi' expected")
opar <- par(mar = par("mar"))
on.exit(par(opar))
coolig <- x$li[, c(xax, yax)]
coocol <- x$c1[, c(xax, yax)]
if (permute) {
coolig <- x$co[, c(xax, yax)]
coocol <- x$l1[, c(xax, yax)]
}
s.label(coolig, clab = clab.row)
born <- par("usr")
k1 <- min(coocol[, 1])/born[1]
k2 <- max(coocol[, 1])/born[2]
k3 <- min(coocol[, 2])/born[3]
k4 <- max(coocol[, 2])/born[4]
k <- c(k1, k2, k3, k4)
coocol <- 0.9 * coocol/max(k)
s.arrow(coocol, clab = clab.col, add.p = TRUE, sub = sub,
possub = "bottomright")
add.scatter.eig(x$eig, x$nf, xax, yax, posi = posieig, ratio = 1/4)
}
<environment: namespace:ade4>
Regards, Mark.
-----
Mark Difford (Ph.D.)
Research Associate
Botany Department
Nelson Mandela Metropolitan University
Port Elizabeth, South Africa
--
View this message in context: http://r.789695.n4.nabble.com/How-to-scale-arrows-to-approximately-fill-a-plot-region-tp4169871p4170400.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list