Graphic title with math, text and variables, some italic

Viewed 32

I want a title in a plot which includes Greek letters, subscripts, text and variables. My specific example is of the form:

$\beta_0>0.8\ {\rm where}\ p_0\in [0.4,0.5]$

enter image description here

but where the values of beta=0.8 and of the interval p0=c(0.4,0.5) are variable. I have found examples on Stackoverflow with three of these features but not all four.

1 Answers

Using bquote.

b <- 0.8
i <- toString(c(0.4, 0.5))
plot(1)
title(bquote(italic(β)[0]*phantom() > .(b) ~ 'where' ~ italic(p)[0] %in% .(sprintf('[%s]', i))))

enter image description here

Related