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.