Suppose I wish to generate the following figure in Mathematica:
My thought was to build it in parts. First, I make the plot:
p = Plot[Sin[2 Pi x], {x, 0, 3}]
Then I make the annotation:
g = Graphics[{
Arrowheads[{-0.03, 0.03}], Arrow[{{1/4, 1.2}, {5/4, 1.2}}],
Style[Text[" Period ", Center], Background -> White]
}]
But when I combine them, Mathematica interprets the Center
specification I gave to Text
to mean the center of the entire figure, rather than the center of the Arrow
. So I get the unfortunate output
Show[p, g, PlotRange -> All]
How do I tell Mathematica I want the Text
's position to be centered relative to the Arrow
, not relative to the entire figure?
(I have a lot of things like this to do, so I prefer not to have to specify coordinates for the Text
explicitly.)