I'm currently plotting a heatmap of tax incomes by local authority within the UK. However, I want to focus on one specific local authority, for example Edinburgh.
I want to find the max and min coordinates for Edinburgh so I can narrow it down and have a zoomed in view of Edinburgh on its own without seeing the rest of UK map. Online, for the map found on Open GeoPortal Stats, when looking at edinburgh it only gives one value for longitude and latitude but I need two values for each.
I am currently using xlim and ylim within R for this.
ggplot (data = map_data, aes(x=long, y=lat, group=group))+
geom_polygon(aes(fill=map_data$group))+
coord_equal(xlim=-3.27826, ylim=55.91119))+
theme(legend.position = "none")
How would I find the other max and min coordinates within the dataframe required for Edinburgh? As there 5mill observations, or is there a better way to do it than using xlim and ylim?
Any help would be great.
map_data
? You probably could avoid usingxlim
andylim
altogether by filtering out your data to only include points from Edinburgh, which would result in a map of only Edinburgh. - krfurlong