更新时间:2021-12-08 06:30:42
我不确定您要尝试执行的操作,这可能会或可能不会很好地推广.
I'm not entirely sure what you're trying to do so this may or may not generalise well.
也就是说,一种可能性是将annotate
与coord_cartesian(clip = "off")
一起使用以允许绘图区域之外的文本.
That said, one possibility is to use annotate
with coord_cartesian(clip = "off")
to allow text outside the plot area.
ggplot(mtcars, aes(mpg, cyl, color = vs)) +
geom_line() +
annotate("text", x = 12.5, y = 3.5, label = "Arbitrary text") +
coord_cartesian(ylim = c(4, 8), clip = "off")