看板 MATLAB 關於我們 聯絡資訊
我是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://www.ptt.cc/bbs/MATLAB/M.1470544637.A.16A.html ※ 編輯: noisenose (1.160.122.85), 08/07/2016 13:09:48
immortal1314: 試試看這樣? 08/07 14:05
immortal1314: figure 08/07 14:05
immortal1314: plot(what) 08/07 14:05
immortal1314: title('name') 08/07 14:05
immortal1314: 如果只是想加標題在圖上的話 08/07 14:06
sblk: 例一title括弧中的 l 拿掉即可。即title('My Legend Title') 08/07 17:14
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
physbook: 這篇可解? https://goo.gl/bQXMnb 08/07 21:10
physbook: 不過簡單一點應該用text或annotation就可以加字了 08/07 21:11
noisenose: 樓上大大那連結就是我寫的二法ㄟ QQ 有其他法嗎 08/08 17:41
name0625: 官網上的說明檔是最新版本的,你應該用程式內的doc比較 08/09 06:53
name0625: 好 08/09 06:53