matlab的legend用法:普通用法
参考:http://yuenshome.lofter.com/post/459740_962ca8b
https://blog.youkuaiyun.com/ZC_lianshuang/article/details/81385672
https://www.cnblogs.com/lihuidashen/p/3443526.html
针对:需要绘制的图例较多,用一个句子表达起来式子很长,不美观;此外,在绘图的开始,无法提前获知需要画多少个图例。
针对多个图形标注其中几个图形的情况:参看:下面
http://fanlizi04.blog.163.com/blog/static/176729245201272735430969/
http://blog.sciencenet.cn/blog-662112-764543.html
x = -pi:pi/20:pi;
y1 = sin(x);
plot(x,y1)
hold on
y2 = cos(x);
plot(x,y2,’–’)
hold off
legend(‘sin(x)’,‘cos(x)’,‘Location’,‘northwest’,‘Orientation’,‘vertical’)
!matlab默认情况
x = -pi:pi/20:pi;
y1 = sin(x);
plot(x,y1)
hold on
y2 = cos(x);
plot(x,y2,’–’)
hold off
legend(‘sin(x)’,‘cos(x)’,‘Location’,‘northwest’,‘Orientation’,‘horizontal’)

本文详细介绍Matlab中legend函数的使用方法,包括如何处理多个图形的图例标注,特别是当图例数量较多且需要垂直或水平布局时的技巧。通过实例演示如何创建美观且信息清晰的图例。

被折叠的 条评论
为什么被折叠?



