R图形编程命令
请告诉命令将以下内容作为图表左上角的图例写入:R图形编程命令,r,legend,R,Legend,请告诉命令将以下内容作为图表左上角的图例写入: (\mu\u 1\mu\u 2)=(8,7)其中8和7来自程序中分配的变量mu1和mu2的值。您可以使用编写表达式并将变量mu1和mu2放在中(): mu1substitute函数非常适合此场景(借用@Julian的示例) mu1查看?图例 mu1 <- 7 mu2 <- 8 plot(1,1) legend("topleft", legend=bquote((mu[1]*","*mu[2])==(.(mu1)*","*.(mu2)))
(\mu\u 1\mu\u 2)=(8,7)
其中8和7来自程序中分配的变量mu1和mu2的值。您可以使用编写表达式并将变量mu1
和mu2
放在中()
:
mu1substitute
函数非常适合此场景(借用@Julian的示例)
mu1查看?图例
mu1 <- 7
mu2 <- 8
plot(1,1)
legend("topleft", legend=bquote((mu[1]*","*mu[2])==(.(mu1)*","*.(mu2))))
mu1 <- 7
mu2 <- 8
plot(1,1)
legend("topleft",
legend=substitute((list(mu[1], mu[2]))==(list(mu1,mu2)),
list(mu1=mu1, mu2=mu2))
)