Closed asierrl closed 3 years ago
Hi, glad the package is coming in handy.
I'm afraid that I'm not quite sure that I've understood what you are trying to plot. Could you provide a couple of example data entries?
If the three indices are independent, then a 3D plot would be more appropriate than a ternary plot, which assumes that the three components being plotted sum to 100%. For example, where ought a tree with the indices 1, 1, 1 plot in ternary space?
I suspect that I've got the wrong end of the stick somewhere -- do put me right if so!
Cheers,
Martin
Sure, Martin. I am trying to plot something weird. These are my points: A tibble: 5 x 5 expto trat Defensas Growth Reproduc
Hi, Martin. I've been thinking deeper on the issue and looked for alternatives. I really think a 3D plot would not fit my needs, as visualizing the tensions of the three-sided trade-off in such a plot is really difficult. I've been playing around with a spider or radar plot, but seeing the direction of the effect size of the treatments (this was the index) on the three functions requires to visualize a central point. Maybe I misunderstand the relationship between a 3D plot, a spider plot and a ternary plot, but isn't a ternary plot an isometric view of a 3D plot where the center is the origin of the 3D plot? If this is true, doesn't using it make sense even if the three dimensions don't sum up to a constant? I realize that in this situation (this isometric view) we lose some information, that on the magnitude of the overall sum, where the central point is equal for any case with X=Y=Z. This leaves only the relative magnitude of the three dimensions. That is exactly what I am looking for, as the overall value of the three effect sizes is not of interest for me, I am only interested in it's bias in one or other dimension. Does that makes sense to you? Is there a way I can work with this "-1 to 1" scale? Or work with a 0 to 2 scale and simply change the tick labels of the plot? Thanks a lot. Asier
I think the point is that the coordinates of your first data point, -0.139 0.486 0.108
, do not exist in Ternary space. The coloured background is obscuring the gridlines, which perhaps makes this less obvious, but the lines -0.129 and 0.486 do not intersect at 0.108. You would need to think of a way of projecting your data into a suitable coordinate system, where the three variables only have two degrees of freedom.
Oh! You're right...I did not fit my conceptual reasoning with it's corresponding maths. I have three coordinates in the original xyz (in a scatter plot; as a,b and c in 1 below), and I would need to transform them in coordinates in the new triangle axes (as a', b' and c' in 4). I would then need to move the origin to -1 and rotate the coordinates. Thanks a lot! I missed that step.
Yep, that looks like a good approach – glad you could figure it out.
Hi, Martin. Great package to make nice ternary plots!! Thanks for building it!
I am trying to make a ternary plot of an index for the three main dimensions of tree performance. The index varies from -1 to 1 and hence I use "axis.labels = seq(-1, 1, by = 0.2)". I find three different problems, which I think come, at least two of them, from the fact that the code assumes always positive scales:
The points appear out of the plot:
I cannot set the arrow to depart from the very center of the plot. If I use c(0,0,0) as the origin of arrows, I get the following error message and the arrows are missing: Error in if (x_deviation == 1) { : missing value where TRUE/FALSE needed. It works smoothly with c(0.001, 0.001, 0.001)
I cannot make TernaryArrow correctly read the destination ternary coordinates from a data frame (where each coordinate is in a separate field). When using the data frame (instead of a list of vectors), I get the following error message and no arrow is displayed: Error in CoordinatesToXY(toCoordinates) : Coordinates must be ternary points
Best regards, Asier