我在协调绘图中不同元素的大小方面遇到了一些问题。具体而言,我希望注释的大小与y轴标题的大小相同。
然而,以下代码生成的大小却不同:
library(ggplot2)
test_data <- data.frame(x = c(1), y = c(1))
ggplot(test_data) +
geom_point(aes(x = x, y = y)) +
theme_bw(base_size = 14) +
annotate("text", label = "A", x = 0.975, y = 1.025, size = unit(14, "pt")) +
ylab("Why not the same size?") +
theme(axis.title.y = element_text(size = unit(14, "pt")))
怎么回事?