How can i insert a variable value (number) into modified figure legend
Mostrar comentarios más antiguos
I'm trying to insert a variable value (number) in the figure legend, but i'm modifying the legend text as shown in the code snippet below, i tried num2str but i couldn't get it right. The figure contains two plots, The variable value would be inserted between the parenthesis after the text "Linear Fitting"
legend({'\color{blue} Test Results (G_{coh} = 1.8)','\color{red} *Linear Fitting ()*'},'Location','northoutside','Orientation','horizontal','FontWeight','bold','FontSize',10)
Thanks in advance
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 16 de Ag. de 2016
Try sprintf():
string1 = sprintf('The number is %.4f', someNumber);
string2 = sprintf('The other number is %.4f', someOtherNumber);
legend(string1, string2);
Categorías
Más información sobre Legend en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!