viridius
viridius

Reputation: 497

Get rid of auto spacing using bquote in r

I am attempting to label a plot axis in r using the bquote function. The desired string includes the greek mu character and a variable.

This results in spaces in either side of the mu:

xlab = bquote("Lake NO3 (" ~ mu ~ "mol/L): " ~ .(i))

How can I get rid of the spaces next to mu?

I tried using paste and paste0 expressions, but neither of these allow both a greek character and a variable.

Upvotes: 17

Views: 6197

Answers (1)

akrun
akrun

Reputation: 887118

If you want to get rid off space on either side of mu

i <- 25
plot(1, xlab=bquote("Lake NO3 ("*mu*"mol/L): " ~.(i) ))

If you need space on the right

plot(1, xlab=bquote("Lake NO3 ("*mu~ "mol/L): " ~.(i) ))

Upvotes: 25

Related Questions