简体   繁体   English

在我的R线图中添加标准误差线

[英]Add standard error bar to my line graph in R

I have a bar graph that I would like to add standard deviation. 我有一个条形图,我想添加标准偏差。

My graph equation is: 我的图形方程式是:

curve((exp(1.54 + -0.59*x) )/ (1+ exp (1.54- 0.59*x)), 0,30, ylab = "occupancy", xlab = "Livestock (%)", ylim=c(0,1))

I would like to add two extra lines representing Standard deviation to the graph ( SD= (exp(0.98-0.55*x) )/ (1+ exp (0.98- 0.55*x) ) 我想在图表上添加两条额外的线表示标准偏差( SD= (exp(0.98-0.55*x) )/ (1+ exp (0.98- 0.55*x)

I have tried using the function errbar but have been unsuccessful. 我尝试使用函数errbar但未成功。

Can anyone help please? 有人可以帮忙吗?

You can create the plot with curve : 您可以使用curve创建图:

curve((exp(1.54 - 0.59 * x) )/ (1 + exp (1.54 - 0.59 * x)), 0, 30, 
      ylab = "occupancy", xlab = "Livestock (%)", ylim = c(0, 1))

Then, you can use curve with the argument add = TRUE to add a line to the existing plot: 然后,可以使用带有参数add = TRUE curve来向现有绘图添加一条线:

curve((exp(0.98 - 0.55 * x)) / (1 + exp(0.98 - 0.55 * x)), 
      add = TRUE, col = "red", lty = 2)

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM