title: How to highlight points in a facet grid with ggplot?
body: <p>I have the following data in long form:</p>
  
  <pre><code>data &lt;- '"","n","variable","value"
  "1",1,"adjr2",0.0365013693015789
  "2",2,"adjr2",0.0514307495746085
  "3",3,"adjr2",0.0547096973547058
  "4",4,"adjr2",0.0552737311430782
  "5",5,"adjr2",0.0552933455488706
  "6",6,"adjr2",0.0552904097804204
  "7",1,"cp",631.119186022639
  "8",2,"cp",132.230096988504
  "9",3,"cp",23.4429422708563
  "10",4,"cp",5.55840294833615
  "11",5,"cp",5.9017131979017
  "12",6,"cp",7
  "13",1,"bic",-1156.56144387716
  "14",2,"bic",-1641.2046046544
  "15",3,"bic",-1741.38235791823
  "16",4,"bic",-1750.90145310605
  "17",5,"bic",-1742.19643112204
  "18",6,"bic",-1732.73634326858'
  
  df &lt;- read.csv(text=data)
  </code></pre>
  
  <p>I want to create a point plot for every variable. Currently, I'm doing this with <code>ggplot2</code>:</p>
  
  <pre><code>ggplot(df) + geom_point(aes(x = n, y = value, fill = variable)) + 
      facet_grid(variable ~ ., scale="free_y")
  </code></pre>
  
  <p>The result is the following:
  <a href="https://i.stack.imgur.com/po6LV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/po6LV.png" alt="plot"></a></p>
  
  <p>I would now like to highlight with a different colour one point for each subplot. I cannot figure out how to add it to the current <code>geom_point</code>, is it even possible?</p>
  
  <p>For example, how would I highlight the maximum in the first subplot and the minimum in the other two? Like this, for the first one:
  <a href="https://i.stack.imgur.com/WGbx2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WGbx2.png" alt="plot"></a></p>
  
  <p>I found a way to do it manually with three separate plots which are then joined in a grid, but that solution is 25 lines and there's a lot of repeated code. Is there a way to do it by just slightly modifying the above snippet?</p>
  
  <p>(By the way, the minimum and maximum are found as <code>which.min(df$value[df$variable == 'cp'])</code>, etc.)</p>