Search code examples
rggplot2ggtern

Changing number of breaks/labels in ggtern


I'm trying to change the default of 5 breaks to 3 breaks (i.e., axis labels at 33, 67 and 100). I've tried this, but it doesn't seem to work:

ggtern(data = Data1, aes(E,L,H),
       labels_tern(limits = c(0,1), breaks=3,
                   format = "%g", factor = 100),
       breaks_tern(limits = c(0,1),TRUE,n=3))+
  theme_hidegrid_minor()

Plot that I'm getting: enter image description here

Thanks.


Solution

  • The following works, because the arguments to limit_tern(...) get passed through to all of scale_X_continuous (X = T, L, R)

    library(ggtern)
    ggtern() + 
      limit_tern(breaks       = c(1/3,2/3,1.0),
                 labels       = c(33,66,100),
                 minor_breaks = NULL)
    

    Output