1

I am using lattice to build a figure. It should contain curly brackets (}) that differ in height but that all have the same width. Is there a way to do "draw" such brackets in R?

It is easy to use grid.text, panel.text, etc. to add brackets, or any other text, to a figure. But with any font -- even a monospaced font -- brackets that have a larger height will also have a larger width. That isn't acceptable for my current figure. I need to "stretch" some brackets vertically without stretching them horizontally.

The method that comes mind is to stitch together many different line segments to create something that looks like a bracket. But this will be difficult. Is there any other way?

Others have asked related questions. For example, at ggplot2: Curly braces on an axis?, another user asks about using ggplot2 to add curly brackets to a plot. But as the commenters who respond to that post concede, the solutions that they offer are klugey -- and in any case, I am looking for a lattice-based solution, not a ggplot2-based solution. I am also looking for a solution that can create brackets of differing height while holding width constant; this problem isn't taken up in other posts.

Community
  • 1
  • 1
user697473
  • 2,165
  • 1
  • 20
  • 47
  • Would [this](http://stackoverflow.com/q/7001799/324364) method work? – joran Jun 25 '14 at 02:10
  • That method uses grid so it should work, even though it is labeled as involving ggplot. – IRTFM Jun 25 '14 at 03:55
  • @joran: thank you. I still haven't found a function that lets one specify the endpoints of the bracket –– e.g., y1 and y2 for the top and bottom of the bracket. Such a function would be ideal. But the method to which you linked can be made to work. That said, I went instead with a slightly different method––[your own](http://stackoverflow.com/a/6179288/697473). – user697473 Jun 25 '14 at 08:23

0 Answers0