Problem with legends

3 visualizaciones (últimos 30 días)
jorge
jorge el 11 de Mayo de 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.

Respuesta aceptada

Daniel Shub
Daniel Shub el 11 de Mayo de 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')

Más respuestas (1)

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

Categorías

Más información sobre Legend en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by