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?

New contributor
Den Jaka is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\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 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

Den Jaka is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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