I want to put a circled number on a graph as a marker near (but not on) a point. Sounds easy, but I also want to be invariant of zoom/aspect ratio changes.
Because of this invariant, I can't draw a circle as a line object (without redrawing it upon rescale); if I use a circle marker, I'd have to adjust its offset upon rescale.
The simplest approach I can think of is to use the Unicode or Wingdings characters ① ② ③ etc. in a string for the text()
function. But unicode doesn't seem to work right, and the following sample only works with ① and not for the other numbers (which yield rectangle boxes):
works:
clf; text(0.5,0.5,char(129),'FontName','WingDings')
doesn't work (should be a circled 2):
clf; text(0.5,0.5,char(130),'FontName','WingDings')
What gives, and can anyone suggest a workaround?
This seems to work for me, uses Matlab's latex interpreter, and
\textcircled
:The
\textcircled
command seems have some offset problems, maybe you can try to improve the used latex command and let us know :)Following the above link, for example, I get better results with:
Still, two digit numbers look awful.
Here is an example where the markers (text+circles) are invariant to zoom/resize:
Compare against the LaTeX-based solution that @catchmeifyoutry proposed (pay attention to the two-digits numbers):