library(tidyr)
library(ggplot2)
#faili sisselugemine ja andmete formaadi korrigeerimine
J114=read.csv("PT1-T1.1-J1.1.4.csv",header=TRUE, encoding ="UTF-8")
J114=na.omit(J114)
names(J114)=c("Year","Studying","Working","Retired","Unemployed")
J114=pivot_longer(J114,col=names(J114[,2:5]),"Grupp")


#joonis
ggplot(J114)+
  geom_line(aes(x=Year,y=value,col=Grupp), linewidth=1.5)+
  scale_color_manual(values=c("#6666CC","#FF3600","#8FA300","#4DB3D9"),breaks=c("Studying","Working","Retired","Unemployed"))+
  scale_x_continuous(breaks=(unique(J114$Year)))+
  scale_y_continuous(breaks=c(0,25,50,75,100),limits=c(0,100))+
  ylab("% of people at least somewhat satisfied with life")+
  theme_minimal()+ 
  theme(text = element_text(color="#668080"),axis.text=element_text(color="#668080"))+
  theme(legend.title=element_blank())