簡體   English   中英

Matlab圖例變量

[英]matlab plot legend variable

我的問題是關於matlab圖的圖例條目。

我想在圖例中添加輸入變量,以使其看起來像“ A_1 B_2”。 A,1,B和2是變量letter1,number1,letter2,number2中的輸入參數。

您可以指定任何名稱作為圖例的輸入。 您的問題實際上似乎是關於如何將變量連接為單個字符串。 通常,最簡單的方法是使用[]運算符。

figure()
hold on
h1 = plot(1:10)
h2 = plot(5:15)
legend([letter1,'_',num2str(number1)],...
       [letter2,'_',num2str(number2)])

如果是這種情況,也許您可​​以將其設置在plot命令和標題的末尾,例如:

g <- make_empty_graph() # crate a new canvas to show this example
plot(g) # just to pup up the canvas created

標簽:

legend("bottomleft", legend=c("legend1", "legend2", "legend"), lty=c(1,2,3), lwd=c(2.5,2.5,2.5), col=c("black", "burlywood4", "skyblue"))

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM