Legend Choose Scatter and not plot
3 ビュー (過去 30 日間)
古いコメントを表示
hey all My problem is that in my code i first use the scatter command and then i use the plot cmd . when i ask for the matlab to create a legend he goes by the shapes and colors of the scatter instead of the plot, since i got couple of scatters with different shapes this is not good for me . i tried setting the plot to h1=plot(..) but it didn't work. only made the same color too all the legend.. How could i solve this? Thanks Naty
the code i use:
switch j
case 1
scatter(y_stable(i,j),y1(i,j),'*','b');
scatter(y_end(i,j),y_end(i,j),'o','b')
case 2
scatter(y_stable(i,j),y1(i,j),'*','k');
scatter(y_end(i,j),y_end(i,j),'o','k')
case 3
scatter(y_stable(i,j),y1(i,j),'*','r');
scatter(y_end(i,j),y_end(i,j),'o','r')
end
end
end
end
plot(y0,y1,'b',y0,y1(:,2),'k',y0,y1(:,3),'r',y0,y0,'g');
legend(num2str(alpha(1)),num2str(alpha(2)),num2str(alpha(3)),'refrence','location','best')
0 件のコメント
採用された回答
John Petersen
2012 年 12 月 3 日
legend(num2str(alpha(1)),num2str(alpha(2)),num2str(alpha(3)),'refrence','location','best')
plot(y0,y1,'b',y0,y1(:,2),'k',y0,y1(:,3),'r',y0,y0,'g');
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!