作者noisenose (noisenose)
看板MATLAB
标题[问题]legend的title问题(不是整个图的title喔)
时间Sun Aug 7 12:37:13 2016
我是R2014b
想要打legend的title(不是整个图的title喔) 但
使用matlab官网上范例
x = -pi:pi/20:pi;
y1 = sin(x);
y2 = cos(x);
plot(x,y1,x,y2)
l = legend('sin(x)','cos(x)');
title(l,'My Legend Title')
出现
Error using title (line 27)
Incorrect number of input arguments
Error in filename (line 6)
title(l,'My Legend Title')
使用网路上另一法
x = -pi:pi/20:pi;
y1 = sin(x);
y2 = cos(x);
plot(x,y1,x,y2)
l = legend('sin(x)','cos(x)');
v = get(l,'title');
set(v,'string','Legend Title');
出现
Error using matlab.graphics.illustration.Legend/get
There is no title property on the Legend class.
Error in filename (line 6)
v = get(l,'title');
新手上路 搞不太清楚问题出在哪里 麻烦版上先进指点 非常感谢!
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 1.160.122.85
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/MATLAB/M.1470544637.A.16A.html
※ 编辑: noisenose (1.160.122.85), 08/07/2016 13:09:48
1F:推 immortal1314: 试试看这样? 08/07 14:05
2F:→ immortal1314: figure 08/07 14:05
3F:→ immortal1314: plot(what) 08/07 14:05
4F:→ immortal1314: title('name') 08/07 14:05
5F:→ immortal1314: 如果只是想加标题在图上的话 08/07 14:06
6F:推 sblk: 例一title括弧中的 l 拿掉即可。即title('My Legend Title') 08/07 17:14
7F:推 profyang: 痾...legend的title跟一般的title是有啥不同? 08/07 19:54
※ 编辑: noisenose (1.160.122.85), 08/07/2016 20:07:11
※ 编辑: noisenose (1.160.122.85), 08/07/2016 20:08:18
9F:→ physbook: 不过简单一点应该用text或annotation就可以加字了 08/07 21:11
10F:→ noisenose: 楼上大大那连结就是我写的二法ㄟ QQ 有其他法吗 08/08 17:41
11F:→ name0625: 官网上的说明档是最新版本的,你应该用程式内的doc比较 08/09 06:53
12F:→ name0625: 好 08/09 06:53