globeMap <- read.csv("globeMap.csv")
# Load ggplot library
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.6.3
# create ggplot object and save it in an object. The group parameter is very important because it groups all the coordinates by country
myMap <- ggplot(globeMap, aes(x=long, y=lat, group = as.factor(group)))
# add geometry
myMap <- myMap + geom_polygon(aes(fill=Continent_Name, color=Continent_Name))
# add color palettes
myMap <- myMap + scale_fill_viridis_d()
# add labels
myMap <- myMap + labs(title = "Countries outlined by region", subtitle = "Using a mercator projection", caption = "Dataset retrieved from native ggplot map", x = "Longitude", y= "Latitude")
myMap
