0

How can I overwrite the axis text (the text of the connected to the tix, not the axis title) with a latex expression which is evaluated/printed through latex2exp package?

The usual way of renaming axis text does not work:

MWE

df <- data.frame(x=c("a","b"), y=c(1,2))
ggplot(df, aes(x, y))+
  geom_point()+
  scale_x_discrete(labels=c(TeX("$Test^{89}$"), TeX("$Oh_{i,j}^{99}$")))
BeSeLuFri
  • 623
  • 1
  • 5
  • 21

1 Answers1

0

Just found out - it is related to this question. Basically, you need to wrap unname() around it.

df <- data.frame(x=c("a","b"), y=c(1,2))
ggplot(df, aes(x, y))+
  geom_point()+
  scale_x_discrete(labels=unname(TeX(
    c("$Test^{89}$","$Oh_{i,j}^{99}$"))))
BeSeLuFri
  • 623
  • 1
  • 5
  • 21