I am trying to create a map showing population density for local authority districts but I’m having some trouble creating a suitable legend.
I used this code:
tm_shape(merged_area_population_data) + tm_fill("Population.density..number.of.usual.residents.per.square.kilometre....note.13.")+
tm_borders()+
tm_legend(legend.position = c(0.001,0.01))+
tm_layout(title= "Map of population density", title.size = 1.75,title.position=c(0.01,0.9))
and changed max categories as I was getting this error message previously:
Warning message:
Number of levels of the variable "Population.density..number.of.usual.residents.per.square.kilometre....note.13." is 300, which is larger than max.categories (which is 30), so levels are combined. Set tmap_options(max.categories = 300) in the layer function to show all levels.
tmap_options(max.categories = 300)
I have attached a photo of my map so that you can see the legend and how it is unintelligible.
I have changed the max levels to 300 but it has just created a mess! I am wondering about putting in levels or breaks to make there be less categories but I’m not sure if this will help or not.
If anyone has any ideas about what I could do I would be very grateful.
Thank you!