2022-12-14

r plot text adding variable for text to be bolded

In the example below, the variable holds the letter a. But the legend in legend just returns temp rather than a bolded a. How to make this work like it 'should'?

a <- 2
b <- 5
temp <- letters[1]
temp
plot(a,b)

legend("topleft", legend = c(as.expression(bquote(bold(get(temp)))),
                             as.expression(bquote(temp))))


No comments:

Post a Comment