title: geom_text - finding centroids and adding text in a polygon using ggplot2 -
body: <p>I would like to create a label text layer on a polygon map. 
  This is a very similar query from the two below :</p>
  
  <p><a href="https://stackoverflow.com/questions/22038640/labeling-center-of-map-polygons-in-r-ggplot" title="Labeling center of map polygons in R ggplot">Labeling center of map polygons in R ggplot</a></p>
  
  <p><a href="https://stackoverflow.com/questions/9441436/ggplot-centered-names-on-a-map" title="ggplot centered names on a map">ggplot centered names on a map</a></p>
  
  <p>My dataframe is as follows, (I simplified long and lat for clarity - they are coordinates)</p>
  
  <pre><code>id  long   lat   order  hole    piece  group   locid   location
  
  0   long1  lat1  1      false   1      0.1     1       TEXT I WANT
  0   long2  lat2  2      false   1      0.1     1       TEXT I WANT
  1   long3  lat3  3      false   1      1.1     2       TEXT I WANT2
  1   long4  lat4  4      false   1      1.1     2       TEXT I WANT2
  </code></pre>
  
  <p>This is my current code, it returns a black map - I assume there's text for every long and lat coordinates. 
  I am struggling to find the centroids of each polygon so that i can add a text layer only as per the polygone centre.</p>
  
  <pre><code>testtext &lt;- ggplot() +
             geom_polygon(data = df, mapping = aes(x=long, y=lat, group = group, fill=location)) +
             geom_text(data = df, mapping = aes(x=long, y=lat, group = group, label=location)) +
             geom_path(color = "white") +
             scale_fill_hue(l=40) +
             coord_equal() +
             theme(legend.position = "none", title = element_blank(), axis.text = element_blank())
  </code></pre>
  
  <p>Many thanks</p>