0
我很喜歡我在R中的工作。我想在具有組變量的條形圖上顯示錯誤欄。這裏是數據(文件名s4.csv)。我使用下面的代碼:如何在條形圖上添加錯誤欄
a<- read.csv(file= "s4.csv")
error<- a$Zn_STD
ggplot(a, aes(Variety, Zn))+labs(title="Zinc in flesh and pits of dates") + geom_bar(stat="identity", group= "Variety", fill='steelblue') +
facet_wrap(~ Part)+theme(panel.background = element_rect (fill = "White"))+
ggplot(geom_errorbar(aes(ymin=a$Zn, ymax=a$Zn+error, width = 0.2), position=position_dodge(width=0.8)))
# Here is my Data
# This data contain 3 varieties designated as V and 2 parts (designated as Flesh and Pits) Standard deviation is mentioned as Zn_STD.
Variety Part Zn Zn_STD
V 1 Flesh 0.313333333 0.087
V 2 Flesh 1.113333333 0.43
V 3 Flesh 1.38 0.34
V 1 Pits 1.913333333 0.87
V 2 Pits 1.113333333 0.38
V 3 Pits 1.202222222 0.28
不要在'ggplot'呼叫包'geom_errorbar'。 – Roland