ggplot2如何添加y曲线

用ggplot2跑图,提示要添加y,不然会被后面的替代:
Scale for y is already present.
Adding another scale for y, which will replace the existing scale.

p2 <-plot(res_psa, type = "ac", max_wtp = 100000, log_scale = FALSE) +
  xlab("Willingness-to-pay threshold, × $1000/QALY")+
  scale_y_continuous(name="Probability that the intervention is cost-effective",
                     limits=c(0, 1),
                     breaks=seq(0,1,0.1))+                 
  #scale_color_manual(values = mycolors[1:2])+
  scale_size_manual(values = c(3,3))+
  theme_light()+
  ggtitle("Cost-effectiveness Acceptability Curves")+
  theme(
    axis.text.x=element_text(),
    strip.placement = "outside",
    strip.background = element_rect(),
    ##图形标题设置 字体和大小
    plot.title = element_text(family='Times', face='bold.italic',size = 22),
    ##x坐标轴
    axis.title.x = element_text(family = 'Times',face = 'bold',size =15),
    ##y坐标轴
    axis.title.y = element_text(family = 'Times',face = 'bold',size=10),
    #图例标题
    legend.title = element_text(family = 'Times',face = 'bold',size=10),
    #图例内的字体
    legend.text = element_text(family = 'Times',face = 'bold',size=12),
    #图例位置
    legend.position="bottom"
  )

请问如何添加?

aes函数


p2 <- ggplot(data = res_psa, aes(x = threshold, y = prob)) +
  geom_line(aes(color = prob > 0.5)) +
  xlab("Willingness-to-pay threshold, × $1000/QALY") +
  ylab("Probability that the intervention is cost-effective") +
  scale_y_continuous(limits=c(0, 1), breaks=seq(0, 1, 0.1)) +
  theme_light() +
  ggtitle("Cost-effectiveness Acceptability Curves") +
  theme(
    axis.text.x = element_text(),
    strip.placement = "outside",
    strip.background = element_rect(),
    plot.title = element_text(family='Times', face='bold.italic',size = 22),
    axis.title.x = element_text(family = 'Times',face = 'bold',size =15),
    axis.title.y = element_text(family = 'Times',face = 'bold',size=10),
    legend.title = element_text(family = 'Times',face = 'bold',size=10),
    legend.text = element_text(family = 'Times',face = 'bold',size=12),
    legend.position="bottom"
  )

res_psa数据作为图形的数据源,用aes函数定义X轴(threshold)和Y轴(prob)。然后,你可以添加线型图(geom_line)来显示数据。