Search code examples
rplotggplot2ggtern

plot corner of ternary plot only


I am trying to plot just the corner of a ternary plot (where all my data reside) but cannot seem to figure it out using the scale_"X"_continuous(limits=c(0,20)) , with "X" being set to T, L and R respectively.

dropbox link to dummy data set

Here's what the figure I'm making looks like. I'd like to plot that smallest triangle, if possible. I assume I'd incorrectly defining the limits, because I recieve an error stating "Error: Invalid Ternary Limits, Each Point Must Sum to Unity..." enter image description here


Solution

  • The scale_X_continous() limits arguments seems to need values < 1 to work. This does what you want:

     ggtern(data=dummy,aes(x=x,y=y,z=z,col=type)) +
     geom_point() + 
     scale_T_continuous(limits=c(0,.2))+ 
     scale_L_continuous(limits=c(0,.2))+ 
     scale_R_continuous(limits=c(0.8,1))