hi,
I am trying to create a map with cities label in it, but it keeps giving the following error:
library(mapdata)
library(ggplot2)
pk <- ggplot2::map_data('world2', 'pakistan')
class(pk)
head(pk)
ggplot(pk, aes(x = long, y = lat, group = group)) +
geom_polygon()
dev.off()
library(ggfortify)
pk <- map('world2', 'pakistan', plot = FALSE, fill = TRUE)
class(pk)
autoplot(pk)
p <- autoplot(pk, geom = 'polygon', fill = 'subregion') +
theme(legend.position = "none")
p
cities <- get('world.cities')
cities <- cities[cities$country.etc == 'Pakistan',]
head(cities)
p + geom_point(data = cities, aes(x = long, y = lat),
colour = 'blue', size = 0.1)
Error: Must request at least one colour from a hue palette.
p + geom_point(data = cities, colour = 'blue', size = 0.1)
Error: Must request at least one colour from a hue palette.
Could anyone suggest what's the issue in the code? I copied the code from a website (Plotting with <code>{maps}</code> package) as I am still learning mapping strategies in RStudio.