library(tidyr)
library(ggplot2)
library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
#faili sisselugemine ja andmete formaadi korrigeerimine
J134=read.csv("PT1-T1.3-J1.3.4.csv",header=TRUE, encoding ="UTF-8")


#joonis
  ggplot(J134,aes(x=pererank_sum,y=lapserank,col=Family.type,group=Family.type))+
  geom_point(cex=2.5)+
  geom_smooth(method="lm", linewidth=0.8,se=FALSE)+
  theme_minimal()+
  scale_y_continuous(limits=c(30,70))+
  scale_color_manual(values=c("#1E272E","#FF3600"))+
  theme(text = element_text(color="#668080"),axis.text=element_text(color="#668080"))+
  ylab("Lapse keskmine sissetulek protsentiilskaalas")+
  xlab("Vanemate sissetuleku protsentiil")+
  theme(legend.title=element_blank(),legend.position = c(0.2,0.8))
## `geom_smooth()` using formula = 'y ~ x'