要更改箭头的线条粗细,您可以tern.axis.arrow
通过该theme()
功能访问。然后将大小更改为element_line()
您喜欢的任何内容。
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))
如果您想直接修改箭头选项,您可以从ggtern::theme_bw
函数后面的代码中看到 lineend 从名为 的全局选项调用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>
因此,您可以根据需要调整箭头的选项来调整箭头的类型、大小等。例如,这里我们将箭头更改为 0.75 厘米,将线条粗细更改为 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))
这会产生一个线条更粗、箭头更大的图形。