I'm more used to using bquote than expression for writing equations, so this solution uses that. As mathexpression creates a long string deparse wants to line break so width.cutoff needs to be set.
library(ggplot2)
mathexpression <- bquote(
log~bgroup("(",
log~bgroup("(",
bgroup("(",
frac(1, 2)%*%bgroup("(",
1+exp(-beta),
")"),
")")^-frac(1,beta),
")")^-frac(1,gamma),
")")
)
df <- data.frame(x = c(-1 , 1), y = c(-1, 1))
ggplot(df, aes(x, y)) +
annotate(
"text",
x = 0,
y = 0,
label = deparse(mathexpression, width.cutoff = 160),
parse = TRUE
)
