MATLAB: Problem with legends

bigdatalegendplot

Hello I will use this example for explain my question
figure t=0:pi/200:2*pi; tt= t(1:100:length(t)); plot(t,sin(t)),'b') hold on plot(tt,sin(tt),'b*') legend('a','b')
I have a lot of points, in one curve, and to differentiated with other curves I want to put it square circles or *, the problem is the legend; Is it possible to pluck the two legends in one?.
Or exist other form to do this, because I can not decrease the number of data.

Best Answer

I don't know of an easy clean way to do it, but you can hack it pretty easily by plotting an empty plot with the desired line ...
figure
plot([inf, inf], [inf, inf], 'b-*')
hold on
t=0:pi/200:2*pi;
tt= t(1:100:length(t));
plot(t,sin(t),'b')
hold on
plot(tt,sin(tt),'b*')
legend('ab')