如何在 ggplot r 中的组合条形图和线图中标记线图?

How to label line plot in a combined bar & line plot in ggplot r?

我想组合条形图和线图以及标签线图。 这是我得到的:plot

这是我的代码:

df %>% 
  ggplot(aes(reorder(NAME, pval),y = pval)) + 
  geom_col(aes(x = NAME, y = pval), size = 1, color = "royalblue", fill = "white") +
  geom_line(aes(x = NAME, y = 10*Ratio), size = 1.5, color="#c4271b", group = 1) + geom_text(aes(label = Ratio))+coord_flip()

我想标注折线图,但条形图得到标签?

我的第二个问题: 如何将 y 轴从最大的 -log(pvalue) 重新排列到最低的?

任何帮助将不胜感激!

尝试将 geom_text() 中的 xy aes 设置为 geom_line()

中的相同
geom_text(aes(x = NAME, y = 10*Ratio, label = Ratio))