[R] alternate usage of soil.texture (plotrix)

Dylan Beaudette dylan.beaudette at gmail.com
Mon Jul 21 16:00:09 CEST 2008


Hi, I have used the soil.texture() function from the plotrix package
many times and am very pleased that such a function exists in R. I
have a slightly different need this time, and need some pointers on
how to accomplish it. Instead of plotting single symbols on the
triangle, I would like to outline and fill with a transparent color
several textural classes. For example, if an area had both loam and
sandy loam, I would like to draw a polygon around the entire loam and
sandy loam classes.

Looking at the soil.texture() code, this snippet seems to draw the
outlines of the texture classes. However, when I try plotting just a
couple of the segments in these lists I get lines going off the
original plot.


h1 <- c(85, 70, 80, 52, 52, 50, 20, 8, 52, 45, 45, 65,
            45, 20, 20)/100
        h3 <- c(0, 0, 20, 20, 7, 0, 0, 12, 20, 27, 27, 35, 40,
            27, 40)/100
        t1 <- c(90, 85, 52, 52, 43, 23, 8, 0, 45, 0, 45, 45,
            0, 20, 0)/100
        t3 <- c(10, 15, 20, 7, 7, 27, 12, 12, 27, 27, 55, 35,
            40, 40, 60)/100
        triax.segments(h1, h3, t1, t2, col.lines)


Apart from a purely manual approach using locator(), is there any way
to accomplish what I am trying to do with a slight modification to
soil.texture() ?

Thanks in advance.



More information about the R-help mailing list