How can I show the correation coefficient R in the figure plot?
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Star Strider
el 25 de Dic. de 2017
Editada: Star Strider
el 25 de Dic. de 2017
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 comentarios
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!