library(ggplot2)

#faili sisselugemine ja andmete formaadi korrigeerimine
J312=read.csv2("PT3-T3.1-J3.1.2.csv",header=TRUE, encoding ="UTF-8")
J312$Osakaal=as.numeric(J312$Osakaal)
J312$Aasta=as.factor(J312$Aasta)



#joonis
ggplot(J312)+
  facet_grid(~Sugu)+
  geom_col(aes(x=Aasta,y=Osakaal,fill=Perevorm))+
  theme_minimal()+
  scale_fill_manual(values=c("#81DBFE","#8fa300","#1E272E"))+ #Et anda ette terve vektor värve, on vaja lisada eraldi funktsioon. Siin on vaja sätida "täidet" (filli), seega scale_fill_manual
  theme(text = element_text(color="#668080"),axis.text=element_text(color="#668080"))+
  theme(strip.text.x=element_text(color="#668080"))+
  theme(legend.position = "bottom")+
  ylab("%")+
  xlab("")