I have a spatialpolygonsdataframe with many overlapping features. I want to create a map in which the smaller features are displayed on top of the larger ones so that the small ones aren't fully covered by the large, using ggplot2 in R. How do I reorder the features based on size in the map? ggplot2 code below. I am trying to reorder the geom_polygon bit.
ggplot() + geom_map(data = US, map = US, aes(map_id=region), color="grey45", fill="white", size=0.15)+ geom_polygon(data = all_basins, aes(x = long, y = lat, fill = factor(id)))