The same thing can also be done in R.
library(maps)
library(ggplot2)
library(RColorBrewer)
library(classInt)
esri <- read.csv("C:/Users/User/Documents/MSPA/PRE490/Week3/MktAreas2.csv")
data(us.cities)
total <- merge(esri,us.cities,by="name")
map("state")
nclr <- 3
plotclr <- brewer.pal(nclr,"Set1")
class <- classIntervals(total$Cluster, nclr, style="fisher" )
colcode <- findColours(class, plotclr)
text(total$long, total$lat, total$name, col=colcode, cex=.5)
legend("bottomleft", inset=.05, title="Spatial clusters of US consumers",
legend=names(attr(colcode, "table")), fill=attr(colcode, "palette"), horiz=FALSE)