Matlab作图中图例legend设置

Matlab科学作图中legend的格式,字体,方向,边框,位置,显示方式如下:

legend('\fontname{Times New Roman}USA', '\fontname{宋体}中国');多种字体组合
h0=legend('\it{data}','\rm{20%}\it{ error limit}','location','northeast'); 
legend('Origin(>90°)','data1','Fontsize',40,'FontName','Times New Roman','box','off');%取消边框
lgd.BoxFace.ColorType='truecoloralpha';%透明度
legend({'sin(x)', 'cos(x)'},'Location','best','EdgeColor','b','LineWidth',2);%设置边框颜色为蓝色,边框线宽为2
legend('$$y=e^{1.1x}$$','$$y=e^{1.3x}+100$$','Interpreter','latex','Location','northwest','Fontsize',15,'box','off')% 设置图例,字体latex,公式字体
legend({'sin(x)', 'cos(x)'}, 'Orientation', 'horizontal') % 水平方向图例
legend({'sin(x)', 'cos(x)'}, 'Orientation', 'vertical') % 垂直方向图例
legend('NumColumns', 2);% 添加图例并设置列数为2
legend('Location', 'Best'); % 设置图例位置为最佳位置
legend('Position', [0.2, 0.2, 0.2, 0.2]);%将在图的相对位置为(0.2, 0.2)的地方显示一个宽度为0.2,高度为0.2的图例
plot(x,y,'r','LineWidth',2,'HandleVisibility','off');%画不需要图例的线条
legend('boxoff') % 取消图例边框

位置常用如下
‘north’:位于图的上方中心位置。
‘south’:位于图的下方中心位置。
‘east’:位于图的右侧中心位置。
‘west’:位于图的左侧中心位置。
‘northeast’:位于图的右上方位置。
‘northwest’:位于图的左上方位置。
‘southeast’:位于图的右下方位置。
‘southwest’:位于图的左下方位置。
‘best’:自动选择最佳位置。
‘NorthOutside’
‘SouthOutside’
‘EastOutside’
‘WestOutside’
‘NorthEastOutside’
‘NorthWestOutside’
‘SouthEastOutside’
‘SouthWestOutside’
‘BestOutside’

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

碎月静豪

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值