I am trying to create a map showing the neighborhoods of Manhattan with a number referring to each neighborhood.
I want to associate a number for each of the 29 neighborhoods and display that number at the centroid of each polygon. I then want the legend to display the numbers and the neighborhood name associated with each number.
Below is the code for the map I have created using the tmap package. The shapefile of the neighborhoods is Neighborhood_MN and the column with the name of the neighborhood is 'ntaname'.
neighborhood_colors <- c("#8dd3c7", "#ffffb3", "#bebada", "#fb8072", "#80b1d3", "#fdb462" ,"#b3de69", "#fccde5", "#d9d9d9", "#bc80bd", "#ccebc5" ,"#ffed6f")
tm_shape(Neighborhood_MN) +
tm_polygons(col = "ntaname", title = "Neighborhoods", palette = neighborhood_colors , alpha = 1, scale = 1, size = 100)+
tm_legend(show = TRUE) +
tm_layout("Manhattan Neighborhoods",
legend.title.size = 1,
legend.text.size = 0.6,
legend.position = c("left","top"),
legend.bg.color = "white",
legend.bg.alpha = 1)
How can I associate a number to each neighborhood name that would display on the map?