Adding extra information into a graph which is text?

2 ビュー (過去 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 Center および File ExchangeLegend についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by