factor2"))+ But it doesn't work. Do" /> factor2"))+ But it doesn't work. Do" /> factor2"))+ But it doesn't work. Do"/>

Italic font in one scale label in ggplot

80 Views Asked by At

I want to put one label of x axis with italics font with this code:

  scale_x_discrete(labels = c("factor1", "<i>factor2</i>"))+

But it doesn't work. Do I need to install some package? Is there an alternative way to do so?

1

There are 1 best solutions below

0
Matt B On BEST ANSWER

I would suggest to overwrite the labels as such:

scale_x_discrete(labels = c("factor1", "factor2" = expression(italic(factor2))))+