2

I would like to use a brace in my plot. I have tried the following code, but find that the brace is too thick.

plot(c(0,1), c(0,1))
text(x = 0.5, y = 0.5, '{', srt = 180, cex = 8,font=10)

How can I control the width of the brace depicted in the plot?

DatamineR
  • 10,428
  • 3
  • 25
  • 45
  • Are you referring to the font weight, or the character width? – jbaums Apr 08 '14 at 23:56
  • I suppose you have already tried playing with different fonts to see if there's a thinner font that works for you? – merlin2011 Apr 09 '14 at 00:04
  • Yes, indeed!I find `font=10` the thinnest. But it should be possible to control the width of it, shouldn't it? – DatamineR Apr 09 '14 at 00:05
  • This question may be useful [How to add braces to a graph?](http://stackoverflow.com/questions/6178763/how-to-add-braces-to-a-graph) The width can't be directly changed as it is defined internally by the font's glyph for `{`. – thelatemail Apr 09 '14 at 00:05
  • I took my code from there :-). But my problem is still unsolved... – DatamineR Apr 09 '14 at 00:06
  • You could just add a `lwd=` to the lines calls in Sharon's answer from that page. – thelatemail Apr 09 '14 at 00:09
  • Don't really like her suggestion... – DatamineR Apr 09 '14 at 00:11
  • Maybe you could tell us _what_ you don't really like about her suggestion, so that we don't end up spending time providing a solution that you dislike for the same reasons. – jbaums Apr 09 '14 at 00:24
  • I don't like how they look. I would like to generate a plot for a scientific work – DatamineR Apr 09 '14 at 00:27

1 Answers1

1

This is not a direct way to control the width, but may allow you to achieve the same effect until someone figures out how to do it properly.

Just draw another brace of the same size with the background color, slightly offset from the original one.

plot(c(0,1), c(0,1))
text(x = 0.5, y = 0.5, '{', srt = 180, cex = 8,font=10)
text(x = 0.49, y = 0.5, '{', srt = 180, cex = 8,font=10, col='white')
merlin2011
  • 71,677
  • 44
  • 195
  • 329