x <- WDI::WDIsearch(string = "gdp")
x <- data.frame(x)
rownames(x) <- x$indicator
d <- WDI(country="all", indicator=c("NY.GDP.PCAP.CD"),
start=2014, end=2014)
#d <- left_join(d, countrycode_data, by = "iso2c")
# light grey boundaries
l <- list(color = toRGB("grey"), width = 0.5)
# specify map projection/options
g <- list(
scope = 'europe',
resolution = 50,
showframe = FALSE,
showcoastlines = FALSE,
projection = list(type = 'mercator', scope = 'europe'),
showrivers = TRUE)
plot_geo(d) %>%
add_trace(z = d$NY.GDP.PCAP.CD, color = d$NY.GDP.PCAP.CD, colors = 'Blues',
text = d$country, locations = d$iso3c, marker = list(line = l)) %>%
colorbar(title = 'GDP per capita (current US$)', tickprefix = '$') %>%
layout(title = 'World Development Indicators: GDP per capita (current US$)', geo = g)