t = 0 : 0.01 : 2 * pi;
s = sin(t);
c = cos(t);
m = -sin(t);
hold on;
plot(t, s, 'r');
plot(t, c, 'b');
plot(t, m, 'g');
hold off;
legend('', 'cosine', '');

我的绘图中有几条曲线.我想只为其中一些人展示传奇.我该怎么做?
例如,如何在上面的绘图中仅显示余弦曲线的图例?当我调用legend()函数legend('', 'cosine');而不是添加空的第三个参数时,确实从图例中删除了第三个绿线.但这并没有解决我的问题,因为不需要的红线保持可见.