title: How to reduce geom_text overlap
body: <p>My dataset contains > 500 observations of match activities performed by individual athletes at different locations and recorded over the duration of a soccer match. An example of my dataset is below, where each symbol refers to a match activity. For example, <code>KE</code> is Kick Effective, recorded at 1 minute in the <code>Defense</code>. </p>
  
  <pre><code># Example data
  df &lt;- data.frame(Symbol = c('KE', 'TE', 'TE', 'TI',
                                'KE', 'KE', 'H', 'H',
                                'GS', 'KE', 'TE', 'H',
                                'KE', 'H', 'H', 'GS'),
                  Location = c('Defense', 'Defense', 'Midfield', 'Forward',
                               'Forward', 'Midfield', 'Midfield', 'Defense',
                               'Defense', 'Defense', 'Forward', 'Midfield',
                               'Midfield', 'Defense', 'Defense', 'Midfield'),
                   Time = c(1, 2, 3, 6,
                              15, 16, 16, 20,
                              22, 23, 26, 26,
                              27, 28, 28, 30))
  </code></pre>
  
  <p>I wish to visualise this data, by plotting the match activities over time at each location in <code>ggplot2</code>.</p>
  
  <pre><code># Load required package
  require(ggplot2)
  # Order factors for plotting
  df$Location &lt;- factor(df$Location, levels = c("Defense", "Midfield", "Forward"))
  
      # Plot
      ggplot(df, x = Time, y = Location) +
        geom_text(data=df, 
                  aes(x = Time, y = Location, 
                      label = Symbol), size = 4) +
        theme_classic() 
  </code></pre>
  
  <p>However, some of the <code>geom_text</code> labels overlap one another. I have tried <code>jitter</code> but then I lose meaning of where the activity occurs on the soccer pitch. Unfortunately, <code>check_overlap=TRUE</code> removes any overlapped symbols. I wish to keep the symbols in the same text direction.</p>
  
  <p>Although the symbols are plotted at the time they occur, I am happy to adjust the time slightly (aware they will no longer perfectly align on the plot) to ensure the <code>geom_text</code> symbols are visible. I can do this manually by shifting the <code>Time</code> of each overlapped occurrence forward or back, but with such a big dataset this would take a very long time.</p>
  
  <p>A suggestion was to use <code>ggrepel</code> and I did this below, although it alters the <code>geom_text</code> in the y-axis which is not what I am after.</p>
  
  <pre><code>library(ggrepel)
  ggplot(df, x = Time, y = Location) +
    geom_text_repel(aes(Time, Location, label = Symbol)) 
  </code></pre>
  
  <p>Is there a way I can check for overlap and automatically adjust the symbols, to ensure they are visible and still retain meaning on the y-axis? Perhaps one solution could be to find each <code>Location</code> and if a <code>Symbol</code> is within two minutes of another in the same <code>Location</code>, <code>Time</code> is adjusted.</p>
  
  <p>Any help would be greatly appreciated.</p>