R: using expression in plot legends
plot, r
Solution
We can place everything within the `expression` itself
plot(1)
legend("topleft", expression(alpha~"= 1, "~beta~" = 2"))
If we need `Gamma(`
legend("topleft", expression(Gamma*"("*alpha~"= 1, "~beta~" = 2)"))
If we need the word `Gamma`
legend("topleft", expression("Gamma("*alpha~"= 1, "~beta~" = 2)"))
Problem
I'm trying to use the `legend` function in R. I want the label to read $\alpha = 1, \beta = 2$, so I tried using ``` legend("topleft", c(expression(alpha = 1, beta = 2))) ``` But that did not do the trick. Any advice? What if I wanted my label to read $Gamma(\alpha = 1, \beta = 2)$? I tried ``` legend("topleft", c(paste("Gamma( ", expression(alpha = 1, beta = 2)))) ```