フィルターのクリア

Legend Choose Scatter and not plot

2 ビュー (過去 30 日間)
Naty S
Naty S 2012 年 9 月 27 日
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')

採用された回答

John Petersen
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 件)

カテゴリ

Help Center および File ExchangeLegend についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by