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
J111=read.csv("PT1-T1.1-J1.1.1.csv",header=TRUE, encoding ="UTF-8")
names(J111)=c("Code","Riik","Country","X2008","X2018")

#joonis
p=ggplot(J111,aes(x=X2008,y=X2018,label=Riik))+
  geom_point(cex=2.5,col="#6666CC")+ #C<ksikuid vC$rve saab sC$ttida otse samast funktsioonist (nagu geom_point ja geom_abline)
  geom_abline(intercept = 0, slope = 1, linewidth=1,col="#FF3600")+
  scale_x_continuous(limits=c(4,9),breaks=c(4:9))+
  scale_y_continuous(limits=c(4,9),breaks=c(4:9))+
  theme_minimal()+
  geom_text(aes(x=X2008+0.1,y=X2018+0.1,label=Code),col="#668080")+ #punktide siltide vC$rv
  theme(legend.position = "none")+
  theme(text = element_text(color="#668080"),axis.text=element_text(color="#668080"))+ #kC5ikide muude tekstide vC$rv. See rida peab olema hiljem kui theme_minimal(), muidu kirjutab viimane tekstivC$rvi C<le. 
  ylab("2018")+
  xlab("2008")
  
  ggplotly(p,tooltip=c("Riik"))
## Warning: `gather_()` was deprecated in tidyr 1.2.0.
## ℹ Please use `gather()` instead.
## ℹ The deprecated feature was likely used in the plotly package.
##   Please report the issue at <]8;;https://github.com/plotly/plotly.R/issueshttps://github.com/plotly/plotly.R/issues]8;;>.