16

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.

viridius
  • 477
  • 5
  • 17

1 Answers1

22

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) ))
akrun
  • 874,273
  • 37
  • 540
  • 662