title: Dotplot Annotating on Multiple Facets
body: <p>This very particular question has been driving me crazy! I have a ggplot dot plot that I'm trying to recreate from this website: <a href="https://fivethirtyeight.com/features/complete-catalog-curses-deaths-quentin-tarantino-films/" rel="nofollow noreferrer">https://fivethirtyeight.com/features/complete-catalog-curses-deaths-quentin-tarantino-films/</a></p>
  <p>I've recreated everything except for the annotations. I know that I have to create a data frame in order to annotate on multiple facets, but dot plots don't have a variable y-axis so the following attempt shows an error (I've provided all of my code since it's fairly short):</p>
  <p>library(fivethirtyeight)
  library(ggplot2)
  library(dplyr)
  library(grid)
  library(tidyr)
  head(fivethirtyeight::tarantino)</p>
  <pre><code>movie &lt;- c(&quot;Reservoir Dogs&quot;, &quot;Pulp Fiction&quot;, &quot;Jackie Brown&quot;, &quot;Kill Bill: Vol. 1&quot;, &quot;Kill Bill: Vol. 2&quot;, &quot;Inglorious Basterds&quot;, &quot;Django Unchained&quot;)
  start_year &lt;- c(1992,1994,1997,2003,2004,2009,2012)
  year_info &lt;- data.frame(movie,start_year)
  </code></pre>
  <pre><code>tarantino_df &lt;-fivethirtyeight::tarantino %&gt;%
    mutate(profane, profane = ifelse(profane == T, &quot;Profanity&quot;, &quot;Death&quot;))%&gt;%
    left_join(year_info)%&gt;%
    unite(movie, movie, start_year, sep = &quot;, &quot;)
  
  tarantino_df$movie &lt;- factor(tarantino_df$movie, levels = c(&quot;Reservoir Dogs, 1992&quot;, &quot;Pulp Fiction, 1994&quot;, &quot;Jackie Brown, 1997&quot;, &quot;Kill Bill: Vol. 1, 2003&quot;, &quot;Kill Bill: Vol. 2, 2004&quot;, &quot;Inglorious Basterds, 2009&quot;, &quot;Django Unchained, 2012&quot;))
  tail(tarantino_df,100)
  </code></pre>
  <pre><code>ann_text&lt;-data.frame(minutes_in=c(25,15),movie=c(&quot;Reservoir Dogs, 1992&quot;, &quot;Pulp Fiction, 1994&quot;),label=c(&quot;Label 1&quot;,&quot;Label 2&quot;))
  </code></pre>
  <pre><code>tarantino_plot &lt;- ggplot(tarantino_df, aes(x = minutes_in, fill = profane)) + 
        geom_dotplot(binwidth = 1, method = &quot;dotdensity&quot;, stackratio = 1.2, aes(color = profane), dotsize = 0.5,      stackgroups = TRUE, binpositions=&quot;all&quot;, label.select = list(top.up = 10, top.down = 4)) + 
        facet_wrap(~movie, ncol = 1, shrink = TRUE) + 
        scale_color_manual(values =  c(&quot;red&quot;, &quot;black&quot;))+
        scale_fill_manual(values =  c(&quot;red&quot;, &quot;black&quot;))+ 
        guides(color = guide_legend(reverse = TRUE))+
        guides(fill = guide_legend(reverse = TRUE))+
        theme(legend.position=c(0.05,1.1), legend.title =element_blank(), plot.margin=unit(c(1.5,1,1.5,1.2),&quot;cm&quot;))+
        scale_y_continuous(breaks=c(0, 20), limits = c(0, 20))+ 
        scale_x_continuous(expand = c(0, 0), limits = c(0, 165))+
        theme(panel.spacing = unit(2, &quot;lines&quot;))+
        theme(strip.text = element_text(hjust = 0),strip.text.x = element_text(size = 10))+
        labs(title = &quot;The complete obscene guide to Tarantino&quot;, subtitle = &quot;Time stamp of every instance of profanity and each death in feature films directed by Quentin Tarantino\n\n\n\n\n&quot;, x = NULL, y = NULL)+
        geom_text(data = ann_text,label=ann_text$label)
  
  tarantino_plot
  </code></pre>
  <p>This is the error that I get:</p>
  <blockquote>
  <pre><code>Error in FUN(X[[i]], ...) : object 'profane' not found
  </code></pre>
  </blockquote>