2
$\begingroup$
expr = Uncompress[FromCharacterCode[
    Flatten[ImageData[Import["https://i.sstatic.net/Pva9y.png"], "Byte"]]]];
ListLinePlot[expr, PlotRange -> All,ImageSize -> 1000]

enter image description here

As we see, it just 4 Callout labels? But how to show all Callout labels?

$\endgroup$

2 Answers 2

7
$\begingroup$

Documentation for Callout says, that "Callouts are pruned to avoid collisions" and advices to use "LabelVisibility" option to control this behaviour:

expr = Uncompress[FromCharacterCode[
Flatten[ImageData[Import["https://i.sstatic.net/Pva9y.png"],"Byte"]]]] // 
    ReplaceAll[Callout[args___] :> Callout[args, LabelVisibility -> All]];
ListLinePlot[expr, PlotRange -> All, ImageSize -> 1000]

With LabelVisibility->All

http://reference.wolfram.com/language/ref/LabelVisibility.html

$\endgroup$
1
  • $\begingroup$ I cannot fully reproduce it in a simple example but I find that often the point that the Callout is attached to needs to be within the PlotRange in order for it to appear even when using LabelVisibility->All. This becomes relevant when combining plots and can be confusing since the points in a ListPlot outside the PlotRange do still get included. Just leaving this comment since it might help someone out who like me is confused why some Callouts still aren't visible. $\endgroup$
    – Kvothe
    Apr 3, 2023 at 15:36
7
$\begingroup$
xy = MapIndexed[{#2[[1]], #} &, expr];

data1 = Cases[{p_, Callout[a_, b__]} :> Callout[{p, a}, b]] @ xy;

data2 = xy /. Callout -> (# &);

Show[ListLinePlot[data2], ListPlot[data1], ImageSize -> 800]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.