library(ggplot2)
library(tidyr)

#faili sisselugemine ja andmete formaadi korrigeerimine
J419=read.csv2("PT4-T4.1-J4.1.9.csv",header=TRUE, encoding ="UTF-8")
names(J419)=gsub("X", "", names(J419))
J419=pivot_longer(J419,2:3)
J419$value=as.numeric(J419$value)


#joonis
ggplot(J419)+
  geom_col(aes(x=name,y=value,fill=Sünnikohort), pos=position_dodge(0.8),width=0.7)+
  theme_minimal()+
  facet_grid(~Sugu)+
  scale_fill_manual(values=c("#81DBFE","#6666cc","#f09d00","#bf6900"))+
  theme(text = element_text(color="#668080"),axis.text=element_text(color="#668080"))+
  theme(strip.text.x=element_text(color="#668080"))+
  xlab("")+
  ylab("%")