wrap polygon labels on map in ggplot

Hi,

Before I start, might I remind you that when you share code, it's best to create a reprex. A reprex consists of the minimal code and data needed to recreate the issue/question you're having. You can find instructions how to build and share one here:

This way we can actually use your code and build on it, because what you shared now can't be run in R.

OK, so to get the centroid, there are a few options:

Calculate using centoid function

library(geophys)
centroid(list(x = c(1,2,1,2), y = c(2,2,5,5)))
[1] 1.5 3.5

Here you provide a list of x and y coordinates, and you get back the centoid

Use sf and ggplot2
This will be a bigger challenge as you have to reformat the data, but the simple features and the ggplot visualisations of them are very powerful. These functions are used to draw complex polygons like maps, and have functions that can position labels built in

Hope this helps,
PJ