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!

