Re: [R] Soil texture triangle in R?

From: Sander Oom <slist_at_oomvanlieshout.net>
Date: Fri 27 May 2005 - 23:42:43 EST

Hi Jari,

I assume this has been superseded by the ternaryplot{vcd} function!?

Thanks,

Sander.

Jari Oksanen wrote:
> Sander,
>
> Just a quick note before I go to the field.
>
> I attach a tri.R file for drawing ternary plots. The base function was
> posted to R News someday. One thing that I added was option to plot
> nothing (type="n") plus (invisible) return of plotting coordinates. This
> means that you can take the coordinates for drawing segments (in
> original values), feed them through this functions, and you get
> translated coordinates to use ordinary segments or lines commands to
> overlay your lines into an existing ternary plot.
>
> We used this in an Applied Vegetation Science paper (Hellström as the
> first author) to overlay arrows onto ternary plots.
>
> cheers, jari oksanen
>
>
> ------------------------------------------------------------------------
>
> "tri" <-
> function(a, f, m, symb = 2, grid = F, ...)
> {
> ta <- paste(substitute(a))
> tf <- paste(substitute(f))
> tm <- paste(substitute(m))
>
> tot <- 100/(a + f +m)
> b <- f * tot
> y <- b * .878
> x <- m * tot + b/2
> par(pty = "s")
> oldcol <- par("col")
> plot(x, y, axes = F, xlab = "", ylab = "", xlim = c(-10, 110), ylim
> = c(-10, 110), type = "n", ...)
> points(x,y,pch=symb)
> par(col = oldcol)
> trigrid(grid)
> text(-5, -5, ta)
> text(105, -5, tm)
> text(50, 93, tf)
> par(pty = "m")
> invisible(cbind(x,y))
> }
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri May 27 23:48:12 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:08 EST