您的位置:首页 > 编程语言 > MATLAB

MATLAB曲线标注、图例与加网格

2019-07-05 21:12 141 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。 本文链接:https://blog.csdn.net/qq_38549334/article/details/94764710

MATLAB画好曲线之后
plot(x,y,‘linewidth’,2); %设置曲线粗细

grid on; %加网格

text(x’,y’,’ \leftarrow 标注内容’); %(x’,y’)为曲线上一点,这段可实现在(x’,y’)点上添加标注,\leftarrow为左箭头可按需更改;

leg=legend(‘r=2mm’,‘r=4mm’,‘r=6mm’,‘r=8mm’,‘r=10mm’);
set(leg,‘FontSize’,30,‘Location’,‘northeastoutside’); %加入曲线图例,并设定图例属性。
%‘FontSize’,30:设定字体大小为30;‘Location’,‘northeastoutside’:设定图例摆放位置。
其中’Location’属性详解为:
‘north’ 坐标轴中的顶部
‘south’ 坐标轴中的底部
‘east’ 坐标轴中的右侧区域
‘west’ 坐标轴中的左侧区域
‘northeast’ 坐标轴中的右上角(二维坐标轴的默认值)
‘northwest’ 坐标轴中的左上角
‘southeast’ 坐标轴中的右下角
‘southwest’ 坐标轴中的左下角
‘northoutside’ 坐标轴的上方
‘southoutside’ 坐标轴的下方
‘eastoutside’ 到坐标轴的右侧
‘westoutside’ 到坐标轴的左侧
‘northeastoutside’ 坐标轴外的右上角(三维坐标轴的默认值)
‘northwestoutside’ 坐标轴外的左上角
‘southeastoutside’ 坐标轴外的右下角
‘southwestoutside’ 坐标轴外的左下角
‘best’ 坐标轴内与绘图数据冲突最少的地方
‘bestoutside’ 到坐标轴的右侧
‘none’ 由 Position 属性决定。可使用 Position 属性在自定义位置显示图例。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: