필터 지우기
필터 지우기

Adding extra information into a graph which is text?

조회 수: 1 (최근 30일)
Deandra  Dsouza
Deandra Dsouza 2017년 9월 4일
댓글: Image Analyst 2017년 9월 5일
So for my appdesigned matlab gui i am plotting the data in the axes. I want to show the rsquare values of 3 models along with plotting the model outcome. However , I am unable to figure out how can I enter the rquare numbers as text into the legend entry box?

채택된 답변

Image Analyst
Image Analyst 2017년 9월 4일
Use sprintf()
legendText1 = sprintf('r squared for model 1 = %f', rSquared1);
legendText2 = sprintf('r squared for model 2 = %f', rSquared2);
legendText3 = sprintf('r squared for model 3 = %f', rSquared3);
legend(legendText1, legendText2, legendText3);
  댓글 수: 2
Deandra  Dsouza
Deandra Dsouza 2017년 9월 4일
I already have a legend for the data curve. I need to additional add this information in the legend box.
Image Analyst
Image Analyst 2017년 9월 5일
textbox = sprintf('%s\n%s\n%s', legendText1, legendText2, legendText3);
text(x, y, textBox);
Use text() and an x,y that places the text where you want it.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by