Search code examples
rannotationsplotmath

R mathematical annotations


I have a problem inserting a vertical line in a mathematical annotation. I have search through the annotation symbols without luck.

I would like to put a mathematical annotation containing conditional probability sign (|) in the x-label of a plot. What I would like is the expression p(x_j | o_i) where "j" and "i" are subscripts.

I have the following construction

plot(1:10, xlab = expression( paste("Likelihood, p" * (y[i] %up% o[j])) ))

and I wold like to substitute the arrow with a vertical line. Any help or guidance is greatly appreciated.


Solution

  • This gets you "there" (for some definition of "there"):

    plot(1:10, xlab = expression("Likelihood, p" * (y[i] ~ "|" ~ o[j])))
    

    plotmath axis label