title: ggplot2: Curly braces on an axis?
body: <p>In <a href="https://stats.stackexchange.com/questions/13999/visualizing-2-letter-combinations/14028#14028">answering a recent visualization</a> question I really needed braces to show a span on an axis, and I can't figure out how to do it in ggplot2.  Here's the plot:</p>
  
  <p><img src="https://i.stack.imgur.com/QIDj1.png" alt="example plot"></p>
  
  <p>Instead of a tick mark, I'd really like the y axis label "Second letter of two-letter names" to have a brace extending from 1 to 10 (the vertical span of the red and blue second letters).  But I'm not sure how to make that happen.  The x axis could benefit from similar treatment.</p>
  
  <p>Code is available in the linked CrossValidated question (and unnecessarily complicated for this example, so I won't show it).  Instead, here's a minimal example:</p>
  
  <pre><code>library(ggplot2)
  x &lt;- c(runif(10),runif(10)+2)
  y &lt;- c(runif(10),runif(10)+2)
  qplot(x=x,y=y) +
    scale_x_continuous("",breaks=c(.5,2.5),labels=c("Low types","High types") )
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/8H4zO.png" alt="minimal example"></p>
  
  <p>In this case, a brace from (0,1) for low types and from (2,3) for the high types would be ideal instead of tick marks.</p>
  
  <p>I'd rather not use <code>geom_rect</code> because:</p>
  
  <ul>
  <li>The tick marks will remain</li>
  <li>I'd prefer braces</li>
  <li>It will be inside the plot instead of outside it</li>
  </ul>
  
  <p>How would I accomplish this?  The perfect answer would have:</p>
  
  <ul>
  <li>A nice, smooth, thin curly brace</li>
  <li>Drawn outside the plotting area</li>
  <li>Specified via a high-level argument (ideally a range-type object passed to the <code>breaks</code> option in <code>scale_x_continuous</code>)</li>
  </ul>