How can I show the correation coefficient R in the figure plot?
3 ビュー (過去 30 日間)
古いコメントを表示
I want to show the correlation coefficient value i.e R in the figure plot. I have used [R,P,RL,RU] = corrcoef(___) command, then I used scatter plot command. Using figure plot tool, I have done basic fitting but the problem is I am not able to show R-value in figure plot. Please help me.
0 件のコメント
回答 (1 件)
Star Strider
2017 年 12 月 25 日
編集済み: Star Strider
2017 年 12 月 25 日
Use a text (link) object. Choose the (x,y) coordinates where you want it to appear, then after you plot your data:
text(x, y, sprintf('R = %.2f', R))
Experiment to get the result you want.
EDIT — To add your ‘R’ value to a legend entry:
R_1 = 0.42;
R_2 = 0.21;
figure(1)
plot(rand(1,20), rand(1,20), 'pg', rand(1,20), rand(1,20), 'pr')
legend(sprintf('Data_1 (R = %.2f)',R_1), sprintf('Data_2 (R = %.2f)',R_2))
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!