Write overrightarrow to letter in plot

조회 수: 9 (최근 30일)
Johannes Herbert
Johannes Herbert 2020년 1월 25일
댓글: Johannes Herbert 2020년 1월 28일
Hey,
I'm wondering if there is a possibility to write a letter with an overrightarrow as a text annotation to a matlab plot. It should look something like this. With greek letter, integrals the latex commands work but for this one it doesn't. Am I doing something wrong here?
Regards,
Johannes
figure(1)
text(-1,0.2,'\overrightarrow{n}');

채택된 답변

Harsha Priya Daggubati
Harsha Priya Daggubati 2020년 1월 28일
Hi,
One issue with the script you have attached is it creates a figure with x and y ticks between 0 and 1, with a difference of 0.1 for each. You are trying to place your text at (-1,0) which is not visible. So, try changing the position of your text.
Secondly, the Interpreter property for text is by default set to Tex, you need to set it to Latex to use ‘overrightarrow’.
Try using the following command:
figure(1)
t = text(0.1,0.2,'\overrightarrow{n}');
set(t,Interpreter,latex);
Hope this works!
  댓글 수: 1
Johannes Herbert
Johannes Herbert 2020년 1월 28일
Thanks, I did the recommended command and it worked. One can also just append it to the text command like:
text(0.1,0.2,'$\overrightarrow{n}$','Interpreter','latex');

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Labels and Annotations에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by