ggplot2 examples

library(tidyverse)
library(mdsr)

CIACounties

Make the base plot g and then add different layers on to it.

head(CIACountries)
# base plot g
g <- CIACountries %>% ggplot(aes(y = gdp, x = educ)) 
g + geom_point()

g + geom_point(size = 3)

g + geom_point(aes(color = net_users), size = 3)

# no geom_point used for the next picture
g + geom_text( aes(label = country, color = net_users), size = 3 )

g + geom_point( aes(color = net_users, size = roadways) )

Change the scales

g + geom_point(aes(color = net_users, size = roadways)) +
  coord_trans( y = "log10")