ms609 / Ternary

Create ternary plots in R
https://ms609.github.io/Ternary/
32 stars 3 forks source link

Feature Request - Ternary Plot with Scaled Axes to Account for Off-Axis Components #84

Closed EkaitzEsteban87 closed 6 months ago

EkaitzEsteban87 commented 6 months ago

The ternary plot is designed to visualize only three components simultaneously. However, for models containing more than three components, the sum of the three on-axis (displayed) components equals 1 minus the sum of the off-axis (non-displayed) components.

Is there a way to scale the plot axes such that the maximum value for a component can reach 1 minus the sum of the off-axis components?

Similar to the approach illustrated here: https://www.jmp.com/support/help/en/17.2/index.shtml#page/jmp/ternary-plots-with-more-than-three-components.shtml#

best regards,

ms609 commented 6 months ago

Thanks for the question. If I've understood the link correctly, all points you would look to plot would have the same values for the off-axis components (x4 and x5), so the Ternary plot is essentially a single plane of the full five-dimensional hyper-tetrahedron.
So the existing auto-rescaling should position the points in the correct location. I think what you are asking is to label the axes accordingly, which can be accomplished using

point <- c(x1 = 0.4, x2 = 0.2, x3 = 0.1, x4 = 0.2, x5 = 0.1)
TernaryPlot(axis.labels = seq(0, 0.7, by = 0.1), grid.lines = 7)
TernaryPoints(point[1:3])

image

Does this accomplish your goals? Is there a general case that you would see as usefully accomplished by an additional parameter to TernaryPlot()?

Related: #83

EkaitzEsteban87 commented 6 months ago

Yes this accomplish my goals. Thank you so much.