필터 지우기
필터 지우기

How to add legends from two plots as one?

조회 수: 4 (최근 30일)
Steinar Bråten
Steinar Bråten 2023년 6월 21일
댓글: Star Strider 2023년 6월 22일
I have a simple algorithm:
%%%%%%%%%%%%%%%%%%%%%%
%% making stickfigure of first position
a1=[ankxA,kneexA,hipxA,shouxA];
Unrecognized function or variable 'ankxA'.
b1=[ankyA,kneeyA,hipyA,shouyA];
a2=[ankx(1,2),kneex(1,2),hipx(1,2),shoux(1,2)];
b2=[anky(1,2),kneey(1,2),hipy(1,2),shouy(1,2)];
......
%% define legends
kne1=['Kne = ',num2str(kneStart(1))];
kne2=['Kne = ',num2str(kneStart(2))];
hoft1=['Hoft = ',num2str(hipStart(1))];
hoft2=['Hoft = ',num2str(hipStart(2))];
......
%% plots
subplot(3, 3, 1);
plot(a1, b1, 'b-');
hold on;
plot(a2, b2, 'r-');
axis ij;
legend(kne1,kne2,hoft1,hoft2,'location','best');
%%%%%%%%%%%%%%%%%%%%%%
But this doesnt work, because it only write the first legend. An easy way to fix this would be apreciated...
  댓글 수: 4
Steinar Bråten
Steinar Bråten 2023년 6월 22일
이동: Star Strider 2023년 6월 22일
Thx all for answer so fast. I know Im newbie here, so again thanks. Attached should be an example of what shows on the subplot for now ..
Star Strider
Star Strider 2023년 6월 22일
Unfortunately, that s vanishingly small, and so difficult to read.
What result do you want?
figure
imshow(imread('legendErr.jpg'))

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by