3

I want to have a legend in an R plot involving expressions. I did

legend(
  x = "topright",
  legend = c(expression(alpha == 0), expression(0 < alpha))
)

This works just fine. But if I replace the 0 < alpha by 0 < alpha < 1 I get an error. Can someone tell me how to get an expression of the form 0 < \alpha < 1? I didn't find it in the web.

Thanks a lot! Maik

Prasanna Nandakumar
  • 4,295
  • 34
  • 63
mg84
  • 287
  • 2
  • 9

1 Answers1

4

Wrap the second comparison in curly braces:

legend(
  x = "topright",
  legend = c(expression(alpha == 0), expression(0 < {alpha < 1}))
)
Hong Ooi
  • 56,353
  • 13
  • 134
  • 187