Adding variables to legends

조회 수: 4 (최근 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