我正在尝试向facet_grid图添加标签。我想实现以下结果:以下是可重现的代码,用于创建数据框和绘图。数据框annotation_text是……
虽然我很感激 eipi10的详细解答 ,这是另一种选择 annotate 。
annotate
p + annotate("text", label = annotation_text$label, size = 4, x = min(myDF$date), y = min(ggplot_build(p)$layout$coord$labels(ggplot_build(p)$layout$panel_params)[[1]]$y.major_source), hjust = -0.3, vjust = -1)
你可以设置 y 至 0 只是 y = 0 同样。
y
0
y = 0