Callout
is a relatively recent functionality that is pretty useful to add custom labels to points and plots. A minimal example of it being used in ListPlot
is
ListPlot[{{0, 0}, Callout[{1, 1}, "Cool label"], {2, 2}}]

What I am looking for is the same exact functionality, but for points in Graphics
objects. I'm looking for a good way to do the above with points drawn with something like
Graphics[{Point@{{0,0},{1,1},{2,2}}}]
Unfortunately, naive guesses such as Point@Callout[{0,0},"ASD"]
, Callout[Point@{0,0}]
don't seem to work. The documentation of Callout
also doesn't mention any example using Graphics
object, which makes me thing the functionality simply isn't implemented for Graphics
.
Is there a good way to still do the above? Of course, I could "hack it" by having the callout drawn in a ListPlot
, and then put in the embedding Graphics
via Show
. Something like:
Show[
Graphics[
Point@{0, 0},
PlotRange -> ConstantArray[{-1, 1}, 2], Frame -> True
],
ListPlot[
{Callout[{0, 0}, "Cool label"]},
Axes -> False, PlotStyle -> Directive[Opacity@0]
]
]

does what it should, but isn't exactly "nice".
Is there a better way to achieve this?
It doesn't have to be a solution with Callout
; similar functionality using something else would also be fine. As long as it doesn't require manually drawing and positioning label and connecting line.
Text
is what you are looking for? $\endgroup$