increase the thickness of arrows in ternary plots

To change the line thickness of the arrows, you can access tern.axis.arrow through the theme() function. Then change the size of element_line() to be whatever you’d prefer.

library(ggtern)
# Based of random data.
DATA <- data.frame(A = runif(100), B = runif(100), C = runif(100))
ggtern(data = DATA, 
               mapping = aes(x = A, y = B, z = C)) + 
  geom_point() + 
  ggtern::theme_bw(base_size = 30) + 
  theme_arrowlarge() +
  theme(tern.axis.arrow = element_line(size = 3))

If you’d like to modify the arrow options directly, you can see from the code behind the ggtern::theme_bw function that the lineend calls from a global option called tern.arrow.

function (base_size = 12, base_family = "") 
{
    base = ggplot2::theme_bw(base_size, base_family)
    theme_ggtern(base_size, base_family) %+replace% base %+replace% 
        theme(tern.plot.background = element_rect(size = NA, 
            color = NA), tern.axis.line = element_line(color = base$panel.border$colour), 
            tern.axis.arrow = element_line(color = base$panel.border$colour, 
                lineend = getOption("tern.arrow")))
}
<bytecode: 0x7fb23868a558>
<environment: namespace:ggtern>

So, you can play around with the options for the arrow as needed to adjust the arrow type, size, etc. For example, here we change the arrow head to be 0.75 cm and the line thickness to be size 3.

DATA <- data.frame(A = runif(100), B = runif(100), C = runif(100))
options(tern.arrow = arrow(type = "open", length = unit(.75, "cm")))
ggtern(data = DATA, 
               mapping = aes(x = A, y = B, z = C)) + 
  geom_point() + 
  ggtern::theme_bw(base_size = 30) + 
  theme_arrowlarge() +
  theme(tern.axis.arrow = element_line(size = 3))

This produces a figure with thicker lines and bigger arrows.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top