How to add Geek letters within data cursor text box?
Show older comments
Dear all,
Hello
Any body knows how can I add Greek alphabet within a text box of Datacursor? (In an m. file, using back slash (\omega) dsiplays: Greek alphabet omega. But within a text box of Data cursor, it litteraly displays \omega !
Any ideas?
5 Comments
Tommy
on 20 Apr 2020
Is something like this what you mean?
plot(randi(10,10,1),'o')
dcm = datacursormode(gcf);
dcm.UpdateFcn = @(~,~) '\omega';

Alireza Babaei
on 21 Apr 2020
Edited: Alireza Babaei
on 21 Apr 2020
Tommy
on 22 Apr 2020
The function which appears when you right-click on the datatip and select 'Edit Text Update Function' is the same function I access by
dcm.UpdateFcn
after I call
dcm = datacursormode;
so my comment above is really the same thing as what you are doing. Sure enough, when I follow the steps you outlined (right-click a datatip, choose to edit the update function, and change the 'X' to '\omega'), I still see the Greek symbol in my datatip.
What version of MATLAB are you running? I am using R2019a. I would guess you are using a version pre-R2018b, which is when datatips started using the TeX interpreter. The TeX interpreter will display the Greek symbols correctly.
If you run the below code, is anything displayed or do you get an error?
clc
x = linspace (0,pi/4,200);
y = sin(x)+cos(x);
figure(1)
plot(x,y)
grid on
dcm = datacursormode;
disp(get(dcm,'Interpreter'));
Alireza Babaei
on 23 Apr 2020
Tommy
on 24 Apr 2020
Ah ok then as far as I can tell, it seems like you won't be able to see the Greek symbols on datatips with your version. I'm not sure if you could use text() instead or maybe some other method of displaying text in figures...
Answers (0)
Categories
Find more on Labels and Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!