30

16

I am trying to place a curly brace within a plot such that the top/bottom of the curly brace line up with two horizontal lines in the plot:

I have not been able to find a way to make the curly brace have the right size without setting the size explicitly by hand. Insetting a Text object doesn't work as the font size is used to scale text, and guessing the right font size is a complete guessing game. I settled upon using "Pane" with the "ResizeToFit" ImageSizeAction set, however I am not sure how to then specify the Inset size or the ImageSize for pane to get the desired results.

Here is the code I am using to generate this plot. ImageSize being set to "5" is just a guess to get approximately the right size, but ideally I want the top/bottom of the curly brace to exactly line up with the two horizontal dashed lines:

```
f = 1/x;
ϵpl =
Plot[{f}, {x, 0, 1}, PlotStyle -> Black,
PlotStyle -> AbsoluteThickness[1]];
ϵ1pl =
Plot[{f}, {x, 0.2, 0.4},
PlotStyle -> Directive[Red, AbsoluteThickness[1.5]]];
ϵ1dashed =
ListPlot[{{{0.1, f /. x -> 0.27}, {0.27, f /. x -> 0.27}}, {{0.1,
f /. x -> 0.3}, {0.3, f /. x -> 0.3}}},
PlotStyle -> Directive[Red, Dashed, AbsoluteThickness[1]],
Joined -> True];
Show[ϵpl, ϵ1pl, ϵ1dashed,
PlotRange -> {{0, 1}, {0, 6}}, Axes -> False, Frame -> True,
ImageSize -> 600,
FrameStyle -> Directive[AbsoluteThickness[1], FontSize -> 24],
FrameTicks -> False, FrameLabel -> {"\!\(\*
StyleBox[\"r\",\nFontSlant->\"Italic\"]\)", "\!\(\*
StyleBox[\"ϵ\",\nFontSlant->\"Italic\"]\)"},
Epilog ->
Inset[Pane["{", ImageSize -> 5,
ImageSizeAction ->
"ResizeToFit"], {0.095, ((f /. x -> 0.27) + (f /. x -> 0.3))/
2}, {0, 0}, {Automatic, (f /. x -> 0.27) - (f /. x -> 0.3)}]]
```

Additionally, I would like to be able to scale the curly brace such that the original aspect ratio isn't maintained (i.e. the width of the curly brace will be a fixed value, but the height can vary). What is the best way to go about doing this?

Excellent, exactly what I was looking for. – Guillochon – 2012-04-17T21:47:12.887

Very nice. I figured there might be an easy way to do this. +1 – Andy Ross – 2012-04-17T22:03:59.303

@Mr.Wizard FilledCurve[] and JoinedCurve[] are new in 8 ... and the ImportString thing is returning a FilledCurve[ blah blah] – Dr. belisarius – 2012-04-17T22:37:22.103

1as they say: "duh" -- I've really gotten lazy; sorry. – Mr.Wizard – 2012-04-17T22:52:38.137

2+1 for "Vectorizing the font", just the thing

Iwas looking for. – István Zachar – 2012-04-18T00:17:26.813