[R] triangular plot
David Winsemius
dwinsemius at comcast.net
Thu Jun 11 16:02:34 CEST 2009
On Jun 11, 2009, at 8:56 AM, Penner, Johannes wrote:
> Sorry for probably again an easy question but I can not find the
> solution...
>
> Using the ade4 package I am drawing a triangular graph:
>
> triangle.plot(data2, label = row.names(data2), clab=0.6,
> show.position=FALSE, box=FALSE)
>
> Which is what I want. Unfortunately the labels have a frame and a
> white
> background. I would like to have them without frame and colour,
> similar
> to what you get with type="text".
>
> I tried various things (box, boxes, label.color and settings of par
> via
> fg or bg="transparent") without luck. Any help is highly appreciated.
>
> Thanks a lot in advance
triangle.plot does not have optional parameters to be passed to
accessory functions. Furthermore, it calls scatterutil.eti for the
plotting of boxes which has hard-coded white background in the boxes.
As far as I can tell triangle.plot does not pass a color argument for
the borders of the boxes.
scatterutil.eti
function (x, y, label, clabel, boxes = TRUE, coul = rep(1, length(x)),
horizontal = TRUE)
<snipped code>
if (boxes) {
rect(x1 - xh/2, y1 - yh/2, x1 + xh/2, y1 + yh/2,
col = "white", border = coul[i])
<snipped code>
scatterutil.eti2
function (x, y, label, clabel, boxes = TRUE, coul = rep(1, length(x)),
horizontal = TRUE)
<snipped code>
if (boxes) {
rect(x1 - xh/2, y1 - yh/2, x1 + xh/2, y1 + yh/2,
col = "transparent", border = coul[i])
<snipped code>
I made up a triangle.plot2 and a scatterutil.eti2 with
col="transparent" and provision for passing color parameters to the
borders of the boxes and a got part of the way toward what you are
asking requesting. There is a remaining glitch when I use the first
example in the triangle.plot help page. A minority of items still get
boxes even though they are transparent. Probably has to do with the
default assignment of coul[i] to border. That could certainly be
altered as well.
I could not tell exactly what you mean by "have them without frame and
colour" either because of your use of the indefinite English pronoun
or the use of Aristotelean logic. They (the boxes anyway) currently
have no color. Did you want color added to <something>? At any rate
you can do the same sort of function hacking as I did. There are no
methods or other complicating issues in your way. All the source is
"at the surface."
--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list