library(ggplot2)
#faili sisselugemine ja andmete formaadi korrigeerimine
J232=read.csv("PT2-T2.3-J2.3.2.csv",header=TRUE, encoding ="UTF-8")
names(J232)=c("Faktor","Aeg","high","low","OR")
#joonis
ggplot(J232,aes(x=Aeg,y=OR,col=Aeg))+
facet_grid(~Faktor,labeller = label_wrap_gen())+
geom_point(cex=3)+
geom_errorbar(aes(x=Aeg,ymin=low,ymax=high),width=0.2,linewidth=0.9)+
geom_abline(slope=0,intercept=1,linewidth=0.3)+
theme_minimal()+
theme(legend.title=element_blank())+
theme(legend.position = "none")+
scale_y_continuous(limits=c(0.5,2.5),breaks=seq(0,3,0.5))+
ylab("Ĺ ansisuhe (OR) ja 95% usaldusvahemik")+
xlab("")+
theme(axis.text.x = element_text(angle = 90))+
scale_color_manual(values=c("#6666cc","#668080","#f09d00","#FF3600"))+
theme(text = element_text(color="#668080"),axis.text=element_text(color="#668080"))+
theme(strip.text.y = element_text(angle = 360,color="#668080"),strip.text.x=element_text(color="#668080"))
