Plotting a Legend on a Graph
조회 수: 5 (최근 30일)
이전 댓글 표시
I have some code for the following plot: however, when I try to introduce the legend for some reason it gives properties A and B for a square in both cases even though the plots includes points which are circles and others which are squares.
figure
% plot(Rv, ur(Rm,Knm))
hold on
plot(0.0014,403.07,'bs')
% plot(0.00008875,403.07,'bs')
plot(0.0014,662.18,'bs')
plot(0.0007 ,662.18,'bs')
plot(0.0014 ,878.11,'bs')
plot( 0.0007, 878.11,'bs')
plot(0.0014,1122.83,'bo')
plot( 0.0007 ,1122.83,'bs')
plot(0.0014 , 1317.16,'bo')
plot(0.0007,1317.16,'bs')
plot(0.00056,1317.16,'bs')
plot(0.000866,1317.16,'bo')
plot(0.001057,1317.16,'bo')
plot(0.0014 ,1662.65,'bo')
plot(0.0007044,1662.65,'bs')
plot(0.000563,1662.65,'bs')
plot(0.0004226,1662.65,'bs')
plot(0.0002817,1662.65,'bs')
plot(0.0001409,1662.65,'bs')
plot(0.001409,2152.09,'bo')
plot(0.0007044,2152.09,'bo')
plot(0.000563,2152.09,'bs')
plot(0.0004226,2152.09,'bs')
plot(0.0002817,2152.09,'bs')
plot(0.0002113,2152.09,'bs')
plot(0.0001409,2152.09,'bs')
plot(0.001427,2545.36,'bo')
plot(0.001427,2459.07,'bo')
plot(0.001427,2214.61,'bo')
plot(0.001427,9958.53,'bo')
plot(0.001427,9563.07,'bo')
plot(0.001427,9390,'bo')
plot(0.001427,9045,'bo')
plot(0.0008452,10152,'bo')
plot(0.0007043,10152,'bo')
plot(0.0005635,10152,'bo')
plot(0.0004226,10152,'bo')
plot(0.0002817,10152,'bo')
plot(0.0008452,9239,'bo')
plot(0.0007043,9239,'bo')
plot(0.0005635,9239,'bo')
plot(0.0004226,9239,'bo')
plot(0.0002817,9239,'bo')
grid
%lgdc = sprintfc('K_n = %3.1f', Knv);
lgd = legend('A','B');
댓글 수: 0
채택된 답변
KSSV
2020년 2월 4일
A = [0.0014,403.07,
0.00008875,403.07,
0.0014,662.18,
0.0007 ,662.18,
0.0014 ,878.11,
0.0007, 878.11,
0.0007 ,1122.83,
0.0007,1317.16,
0.00056,1317.16,
0.0007044,1662.65,
0.000563,1662.65,
0.0004226,1662.65,
0.0002817,1662.65,
0.0001409,1662.65,
0.000563,2152.09,
0.0004226,2152.09,
0.0002817,2152.09,
0.0002113,2152.09,
0.0001409,2152.09] ;
B = [0.0014,1122.83,
0.0014 , 1317.16,
0.000866,1317.16,
0.001057,1317.16,
0.0014 ,1662.65,
0.001409,2152.09,
0.0007044,2152.09,
0.001427,2545.36,
0.001427,2459.07,
0.001427,2214.61,
0.001427,9958.53,
0.001427,9563.07,
0.001427,9390,
0.001427,9045,
0.0008452,10152,
0.0007043,10152,
0.0005635,10152,
0.0004226,10152,
0.0002817,10152,
0.0008452,9239,
0.0007043,9239,
0.0005635,9239,
0.0004226,9239,
0.0002817,9239] ;
figure
hold on
plot(A(:,1),A(:,2),'bs')
plot(B(:,1),B(:,2),'bo')
legend('A','B')
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Legend에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!