library(ggplot2)
library(scales)
#data
J125=read.csv("PT1-T1.2-J1.2.5.csv",header=TRUE, encoding ="UTF-8")
J125$factor=as.factor(J125$factor)
J125$factor=factor(J125$factor,levels=levels(J125$factor)[order(c(4,7,2,3,6,1,5))])
#joonis
ggplot(J125)+
geom_col(aes(x=factor,y=values,fill=Vanus),position = position_dodge(0.8),width=0.7)+
theme_minimal()+
xlab("Stressi allikad")+
ylab("Tekitab olulist stressi (% vastanutest)")+
scale_fill_manual(values=c("#1E272E","#6666cc","#668080","#f09d00","#bf6900","#FF3600","#982F1A"))+
theme(text = element_text(color="#668080"),axis.text=element_text(color="#668080"))+
theme(legend.title=element_blank())+
xlab("")+
ylab("%")+
scale_x_discrete(labels = wrap_format(10))
