library(ggplot2)

#data
J126=read.csv("PT1-T1.2-J1.2.6.csv",header=TRUE, encoding ="UTF-8")
J126=na.omit(J126)
J126$DERS=as.factor(J126$DERS)

J126$DERS=factor(J126$DERS, levels = levels(J126$DERS)[order(c(1,3,2))])


#joonis
ggplot(J126)+
  geom_col(aes(x=VG3,y=Stress,fill=DERS),position = position_dodge(0.8),width=0.7)+
  geom_errorbar(aes(x=VG3,ymin=LO,ymax=HI,col=DERS),pos=position_dodge(0.8),width=0.3,linewidth=0.7,show.legend = FALSE)+
  theme_minimal()+
  scale_y_continuous(breaks=c(25,50,75,100))+
  xlab("Vanus")+
  ylab("Vastanute %, kellel võimalus raskelt haigestuda tekitas stressi")+
  theme(legend.title=element_blank(),legend.position = "bottom")+
  scale_fill_manual(values=c("#1E272E","#668080","#4DB3D9"))+
  theme(text = element_text(color="#668080"),axis.text=element_text(color="#668080"))+
  scale_color_manual(values=c("#FF3600","#1E272E","#1E272E"))