library(ggplot2)
library(tidyr)
library(scales)

#faili sisselugemine ja andmete formaadi korrigeerimine
J221=read.csv("PT2-T2.2-J2.2.1.csv",header=TRUE, encoding ="UTF-8")
J221=pivot_longer(J221,c("Poisid","Tüdrukud"))
names(J221)=c("Aasta","Sugu","Protsent")
J221$Aasta=as.factor(J221$Aasta)


#joonis
ggplot(J221,aes(x=Aasta,y=Protsent,col=Sugu))+
  geom_point(cex=3)+
  geom_label(aes(x=Aasta,y=Protsent+2,label=paste(Protsent,"%",sep="")),show.legend = FALSE)+
  geom_line(aes(col=Sugu,group=Sugu),linewidth=1)+
  theme_minimal()+
  theme(legend.position = "bottom")+
  ylab("Noorte osakaal (%)")+
  scale_y_continuous(limits=c(0,45))+
  scale_color_manual(values=c("#6666cc","#FF3600"))+
  theme(text = element_text(color="#668080"),axis.text=element_text(color="#668080"))