I do not find a way to write a mathematical expression in the legend title of a terra
base plot. Specifically, the mathematical expression contains a fraction with some text at the numerator and denominator, as in the example below. I have tried several commands such as expression
and bquote
, but I am unable to obtain what I need.
x <- rast(matrix(1:25, nrow=5, ncol=5))
plot(x,
legend = T,
plg = list(title = expression(frac(a,b)))
)