COrruption and Human Development

library(ggplot2)
library(ggthemes)
library(plotly)

df <- read.csv(“C:/Data Science/R-Course-HTML-Notes/R-Course-HTML-Notes/R-for-Data-Science-and-Machine-Learning/Training Exercises/Capstone and Data Viz Projects/Data Visualization Project/Economist_Assignment_Data.csv”)

df <- df[,-1]

pl.0 <- ggplot(df,aes(x=CPI, y=HDI)) + geom_point(aes(color=factor(Region)),shape=1,size= 5)

pl_0 <- pl.0 + geom_smooth(method = ‘lm’, formula = y ~ log(x), se= FALSE, color=‘red’)

pl_1 <- pl_0 + scale_x_continuous(name = ‘Corruption Perception Index 2011 (10 = least corrupt)’,
limits = c(0.9,10), breaks = 1:10) + theme_economist_white()

pl_2 <- pl_1 + scale_y_continuous(name = ‘Human Development Index (1 = Best)’,limits = c(0.2,1))

pl_3 <- pl_2 + ggtitle(“COrruption and Human Development”)

gpl <- ggplotly(pl_3)

print(gpl)

Rplot