Adding to a legend after each iteration

前端 未结 5 1637
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-17 15:13

I run

loglog(x,y);
legend(\'First script\');

from the first script. Then, hold on;. I run a similar second script. I see two g

5条回答
  •  不知归路
    2020-12-17 16:03

    plot(x,y);
    legend('y');
    
    hold on;
    plot(x,z);
    hold off;
    
    % Now add a new item to the legend
    
    h = legend();
    newleg = h.String;
    newleg{end+1} = 'z';
    legend(newleg);
    

提交回复
热议问题