我坚持我在 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