How to use TeX / LaTeX formatting for custom data tips in MATLAB?

I am trying to annotate a polar plot with data hints labeled "R: ..., Theta: ...", where theta is actually a Greek symbol, not a word. I am familiar with string formatting using "\ theta", as a result of which a character appears, but in this case it does not work. Is there a way to apply the LaTeX interpreter to data tips? Here is what I still have:

f1=figure;
t=pi/4;
r=1;
polar(t,r,'.');
dcm_obj = datacursormode(f1);
set(dcm_obj,'UpdateFcn',@polarlabel)
info_struct = getCursorInfo(dcm_obj);
datacursormode on

where the polar label is defined as follows:

function txt = polarlabel(empt,event_obj)
pos = get(event_obj,'Position');
x=pos(1);
y=pos(2);
[th,r]=cart2pol(x,y);
txt = {['R: ',num2str(r)],...
    ['\Theta: ',num2str(th*180/pi)]};
+5
source share
1 answer

:. , (R2015a ?) : .


- MATLAB , , TeX/LaTeX ( MATLAB , ). .

, . polarlabel, :

set(0,'ShowHiddenHandles','on');                       % Show hidden handles
hText = findobj('Type','text','Tag','DataTipMarker');  % Find the data tip text
set(0,'ShowHiddenHandles','off');                      % Hide handles again
set(hText,'Interpreter','tex');                        % Change the interpreter

, , handle. 'HandleVisibility' , 'off', , . - 'ShowHiddenHandles' 'on'. findobj, . ( : findall 'ShowHiddenHandles')

hggroup object, . 'Interpreter' 'tex', .

, , polarlabel. , , , (.. polarlabel ), UpdateFcn , .

+8

All Articles