0

As my y-axis stays for two things in the plot, I would like to be able to have, on the same side (left) two labels of the 'kind text1 / text2' with text2 of a particular colour (green). I tried to do so by using latex2exp but I think it does not support the \color LaTeX command. This is what I tried till now:

ggplot() + geom_point(aes(x=1, y=1)) + ylab(TeX('\\text{text1 / } {\\color{DarkGreen} \\text{text2}}')) 
ggplot() + geom_point(aes(x=1, y=1)) + ylab('') + 
  annotate('text', x = 0.25, y = 1, label = TeX('\\text{text1 / } {\\color{DarkGreen} \\text{text2}}'), angle = 90)

The second one fails miserably, also because it is plotting IN the plot and not outside.

Garini
  • 1,088
  • 16
  • 29
  • [This](https://stackoverflow.com/q/25104213/324364) could be a potential duplicate. – joran May 07 '18 at 18:22
  • There's almost certainly a "more ggplot2-like" way to achieve what you want. It would help to provide some more realistic example data and a better description of what you want to do. – neilfws May 08 '18 at 03:01
  • I did not see that question, but the main answer is giving me back this error: `Error in set.gpar(x$gp) : argument must be a 'gpar' object`. – Garini May 08 '18 at 07:46

0 Answers0