0
$\begingroup$

I want to use Callout to make a label of my joining point, instead of using PlotLabels like this

ListPlot[
  {{{2, 0}, {2, 3}}}, Joined -> True, 
  PlotLabels -> Placed["label", Above]
]

https://i.stack.imgur.com/mqd5F.jpg

It is working for a point, but I can't make it work for a list of points:

ListPlot[
  {{0, 0}, Callout[{1, 1}, "Cool label"], {2, 2}}
]

Can anyone help?

$\endgroup$
1
  • $\begingroup$ What version are you using? For version 13.0.1, your code ListPlot[ {{0, 0}, Callout[{1, 1}, "Cool label"], {2, 2}}] gives a callout for the 2nd point. $\endgroup$
    – tad
    Jun 22, 2022 at 13:49

1 Answer 1

1
$\begingroup$

One possible implementation could be:

pts = {{0, 0}, {1, 1}, {2, 2}};
lbls = {"one", "cool", "hot"};

ListPlot[Callout[First@#, Last@#] & /@ Transpose[{pts, lbls}], 
 Filling -> Axis]

enter image description here


EDIT

Or try this variation:

ListPlot[Callout[First@#, Last@#, Above] & /@ Transpose[{pts, lbls}], 
 Filling -> Axis,
 Epilog -> {Red, Dashed,
   Line@pts
   }
 ]
$\endgroup$

Your Answer

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

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