Adding multiple lines in plot using annotation

조회 수: 155 (최근 30일)
Rafael Fehér
Rafael Fehér 2020년 4월 27일
댓글: Rafael Fehér 2020년 4월 28일
I want to add 3 lines to my plot using annotation, but I can't figure out one way to do it jumping line. I'm trying:
dim = [0.15 0.5 0.3 0.3];
str = ['A = ',num2str(A),'\epsilon = ',num2str(epsilon),'k = ',num2str(k)];
annotation('textbox',dim,'String',str,'FitBoxToText','on');
But what I get back is:
How can I jump line between the A = 2 and the \epsilon = 0.05?
Thank you,
Rafael Feher

채택된 답변

Mehmed Saad
Mehmed Saad 2020년 4월 28일
figure,plot(1:10)
A = 2;
epsilon = 0.05;
k=2;
dim = [0.15 0.5 0.3 0.3];
str = {['A = ',num2str(A)],['\epsilon = ',num2str(epsilon)],['k = ',num2str(k)]};
annotation('textbox',dim,'String',str,'FitBoxToText','on');
  댓글 수: 1
Rafael Fehér
Rafael Fehér 2020년 4월 28일
Thank you so much, my friend. So one line means one bracket. Got it!

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

추가 답변 (1개)

Olawale Ikuyajolu
Olawale Ikuyajolu 2020년 4월 28일
text(0.5, 1.5,'Your Text', 'fontsize',6,'color','k','FontWeight','bold');
r = rectangle('Position',[0.3 1.4 5 0.15]','linewidth',1.6);

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by