Problem with legends

3 visualizzazioni (ultimi 30 giorni)
jorge
jorge il 11 Mag 2012
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.

Risposta accettata

Daniel Shub
Daniel Shub il 11 Mag 2012
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')

Più risposte (1)

jorge
jorge il 11 Mag 2012
Great i will use that with:
legend([ ], 'ab,'cd')
if I have more graphics
Thanks a lot :)

Community Treasure Hunt

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

Start Hunting!

Translated by