title: Labeling a US States map
body: <p>I made a map in R and was wondering how to label the States Codes (variable which is in my dataset) appropriately. Using the simple geom_text or even geom_text_repel I get a lot of labels for each State (I can actually understand why), as I proceed to show:</p>
  <p><a href="https://i.stack.imgur.com/xfYNa.png" rel="nofollow noreferrer">Map</a></p>
  <p>How can I solve it so each State gets 1 and only 1 text abbreviation (these State Codes are in my dataset as a variable under the name <code>State Codes</code>)? Thanks in advance.</p>
  <p>Code below:</p>
  <pre><code>library(tidyverse)
  library(maps)
  library(wesanderson)
  library(hrbrthemes)
  
  ggplot(data = data, 
         mapping = aes(x = long, 
                       y = lat, 
                       group = group, 
                       fill = black_percentage)) +
    geom_polygon(col = &quot;black&quot;) +
    geom_text(aes(label = black_percentage)) +
    theme_void() +
    theme(legend.position = &quot;bottom&quot;,
          legend.title = element_blank(),
          plot.title = element_text(hjust = 0.5, family = &quot;Times&quot;, face = &quot;bold&quot;),
          plot.subtitle = element_text(hjust = 0.5, family = &quot;Times&quot;, face = &quot;italic&quot;),
          plot.caption = element_text(family = &quot;Times&quot;, face = &quot;italic&quot;),
          legend.key.height = unit(0.85, &quot;cm&quot;),
          legend.key.width = unit(0.85, &quot;cm&quot;)) +
    scale_fill_gradient(low = &quot;#E6A0C4&quot;, 
                         high = &quot;#7294D4&quot;) +
    labs(title = &quot;Percentage of Black People, US States 2018&quot;,
         subtitle = &quot;Pink colors represent lower percentages. Light-blue colors represents higer percentages&quot;) +
    ggsave(&quot;failed_map.png&quot;)
  
  </code></pre>