# How to change Callout leader size in Plot?

Take this example:

Plot[Callout[Sin[x], Sin[x], Above], {x, 0, Pi}]


Question: How can I change the length of the line connecting the $\sin(x)$ label with the plotted curve?

I believe this line is called the "leader" and it can be modified with the LeaderSize option. But adding either LeaderSize -> 10 or LeaderSize -> {10} to Callout makes no difference.

Motivation: When the plot has a wide aspect ratio, the leaders tend to be too long. I assume this is because they are computed relative to the figure width.

Plot[Callout[Sin[x], Sin[x], Above], {x, 0, Pi}, AspectRatio -> 1/4]


• i don't know why but it seems that the both the leader and the neck change only if you set the position to Automatic : Plot[Callout[Sin[x], Sin[x], Automatic, LeaderSize -> {{70, 0, 0}, {10, 0, 0}}], {x, 0, Pi}, AspectRatio -> 1/4] Sep 3, 2017 at 14:55

Here is a workaround (besides the obvious one of specifying an explicit coordinate instead of Above) where I shrink the neck size:

Plot[
Callout[
Sin[x],
Rotate[Sin[x], -Pi/2],
Above,
FrameMargins -> 0,
],
{x, 0, Pi},
AspectRatio -> 1/4
]


Another possibility is to bend the callout:

Plot[
Callout[
Sin[x],
Sin[x],
Above,
],
{x, 0, Pi},
AspectRatio -> 1/4
]


maybe help:

Table[Plot[
Callout[Sin[x], Sin[x], Above,
LeaderSize -> {100, 90 \[Degree], i}], {x, 0, Pi},
PlotRange -> Full], {i, 0, 30, 5}]


or

Manipulate[
Plot[Callout[Sin[x], "Sin[x]", {Pi/2, a}, Pi/2], {x, 0, Pi},
PlotRange -> {Automatic, {0, 2}}], {a, 1.1, 1.75}]

• @bbgodfrey I have re-edited the answer Sep 3, 2017 at 15:14
• Somehow I was hoping for an answer where the label did go further away from the curve, instead of the gap doing so. Sep 3, 2017 at 15:32

Consider specifying position for the callout {pos, epos}

Plot[Callout[Sin[x], "Sin(x)", {N@\[Pi]/2, 2.},
CalloutMarker -> "\[EmptyCircle]", CalloutStyle -> Gray], {x, 0,
Pi}, PlotRange -> {{0, 3}, {0, 3}}]


• Here you are explicitly specifying the callout position. LeaderSize has no effect Can you point this out in the answer, and remove the superfluous LeaderSize option (since it does nothing here)? Sep 4, 2017 at 8:21

Using different neck lengths:

 Plot[Callout[Sin[x], Rotate[Sin[x],- 90 Degree], Above,
LeaderSize -> {{100, 90 Degree, 0}, {#, 90 Degree}}], {x, 0, Pi},
PlotRange -> Full, ImagePadding->50, ImageSize-> 300] &/@ {0, 30, 70}// Row


It appears that, once the position of the callout label is set (e.g. with Above), the length of the leader is ignored. Instead, one has to let the position of the label be calculated automatically (i.e. Automatic) and specify the position of the anchor instead:

Plot[
Callout[
Sin[x], Sin[x], Automatic, Scaled[0.3],
LeaderSize -> {{15, 90 Degree, 3}, {10, 180 Degree}}
],
{x, 0, Pi}, AspectRatio -> 0.2
]


Unfortunately, symbolic positions such as Above are not available for the callout anchor position, so an explicit position is needed; Scaled coordinates work best for me here.

I ran into similar trouble recently, which is what led me to your question. The solution I propose above is discussed in more detail here: LeaderSize has no effect on Callout in Plot.