Domanda

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

È stato utile?

Soluzione

Wrap the second comparison in curly braces:

legend(
  x = "topright",
  legend = c(expression(alpha == 0), expression(0 < {alpha < 1}))
)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top