1

I want to use the function 'expression' in r to be able to add symbols as '≤' Example:

plot(1:10,1:10)
legend(3,8, c(expression(""<="test ")))

With this code there will be a space between ≤ and test, I want there to be no space: ≤test, how to accomplish this? Thanksenter image description here

user11916948
  • 944
  • 5
  • 12
  • 1
    does trick from here suit your needs https://stackoverflow.com/questions/43696101/r-bquote-remove-the-space-before-approximately-equal-plotmath-symbol e.g.`legend(3,5, ~phantom('')[''<= "test "], cex=3)`; suspect with multiple legend items this will take a bit of faffing about with placement / size – user20650 Jul 05 '22 at 11:14

1 Answers1

1

You could use unicode symbols (\U2264 for ) and do it without the expression?

plot(1:10,1:10)
legend(3,8, "\U2264test") # legend(3,8, "≤test")

enter image description here

harre
  • 7,081
  • 2
  • 16
  • 28