Adding variables to legends

5 次查看(过去 30 天)
Dan Lardner
Dan Lardner 2021-9-18
Hi,
I wish to add a variable to a legend which I have discovered how to do, however I would like to have the initial element within the legend untouched and add the variable to the second parameter within the legend.
This piece of code displays what I want displayed in the legend next to the bottom element. I also want to add the initial set of points above this one.
% Sets up variable to display in the legend
Legr2Lin_R5 = compose('y = bx^m, r^2 = %.3g', r2Pwr_R5);
legend(Legr2Lin_R5,'location','se')
If I use this piece of code I get both elements within the legend, but no variable value for the second element as in the code above.
loglog(x_R4,y_R4,x_R4,Ypwr_R4,'*'),xlabel('x'),ylabel('y')
title('Using y = bx^a')
legend('Data Points','y = bx^a')
The question, how do I have both elements displayed in the legend, but also have the variable value displayed next to the second element within the legend?
I have tried a couple of things, but nothing is coming close to working.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Legend 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by