rnorouzian
rnorouzian

Reputation: 7517

text() to display a greek letter with subscript in R plot

I was wondering how I could make the letter "sigma" appear in Greek with the subscript "m" in the text() part of the R code below?:

curve(dnorm(x,175.3,.961),160,190,type="l")

sigmam <- dnorm(177.4,175.3,.961)/ dnorm(177.4,176,4)

text(165,.285,paste("sigmam", "=", round(1/sigmam,digits=2)))

Upvotes: 5

Views: 4919

Answers (1)

thelatemail
thelatemail

Reputation: 93803

Check out ?plotmath for relevant examples of how to piece this sort of thing together. For instance, here's one adapted from the "## How to combine "math" and numeric variables :"

curve(dnorm(x,175.3,.961),160,190,type="l")
sigmam <- dnorm(177.4,175.3,.961)/ dnorm(177.4,176,4)

text(165,.285, bquote(Sigma[m] == .(round(sigmam,2))))

enter image description here

Upvotes: 9

Related Questions