1. %分两行显示图例,首先需要句柄
    2. h1=plot(x,y1,'r-o');
    3. hold on;
    4. h2=plot(x,y2,'k-d');
    5. hold on;
    6. h3=plot(x,y3,'b-s');
    7. hold on;
    8. h4=plot(x,y4,'m-<');
    9. axis([1 4 0 20]);
    10. lgd1=legend([h1,h2],'第一个图例','第二个图例','orientation','horizontal','location','north');
    11. set(lgd1,'FontName','宋体','FontSize',14);
    12. ah=axes('position',get(gca,'position'),'visible','off');
    13. lgd2=legend(ah,[h3,h4],'第三个图例','第四个图例','orientation','horizontal','location','north');
    14. set(lgd2,'FontName','宋体','FontSize',14);
    15. ————————————————
    16. 版权声明:本文为CSDN博主「Phr-2105」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    17. 原文链接:https://blog.csdn.net/qq_41492768/article/details/90699836