繁体   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