Reputation: 31
I want the mean of the sample to be shown on my y-axis. I tried doing it like they have explained it in this post but it does not seem to work. If you look at the image, the red line represents the mean. I just need the value to be shown on the y-axis. Any help is appreciated.
My R code:
xyear = seq(1920,1978,1)
plot(xyear,difference, type = "bar", col = "blue", main = "Difference between precipitation in winter and summer", xlab = "Year", ylab = "Difference")
abline(difference.mean, 0, col = "red")
Thanks!
Upvotes: 0
Views: 1003
Reputation: 81
xyear = seq(1920,1978,1)
plot(xyear,difference, type = "bar", col = "blue", main = "Difference between precipitation in winter and summer", xlab = "Year", ylab = "Difference")
abline(mean(difference), 0, col = "red")
axis(side = 2, at=mean(difference), labels=T)
axis
command should help in this case. For more information, this page may be helpful.
Upvotes: 1