0

I've added the mu symbol to an axis label using:

 ylab(expression(paste("THC [", mu,"g/g]")))

I tried to make the axis title bold by using:

theme(axis.title.y = element_text(size =10,  face = "bold"))

but it did not work. I'm guessing the element_text did not work as I have a symbol in my axis title. Is there any way to make my axis title all appear in bold text?

jogo
  • 12,469
  • 11
  • 37
  • 42
  • 1
    Hi @Diana Mclaren, welcome to Stack! Maybe try something like ```c(as.expression(bquote(bold("Bold"))```. If you can post a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) that will help others try to answer as well. – Russ Thomas Aug 02 '19 at 13:38
  • Hey Diana, good question! I had the same one a couple years ago! I've marked your question as a duplicate, but maybe you can find your answer on my question: https://stackoverflow.com/questions/38355061/add-a-bold-female-symbol-to-ggplot2-using-annotate – Nova Aug 02 '19 at 14:18
  • This might also help... https://stackoverflow.com/questions/5293715/how-to-use-greek-symbols-in-ggplot2?rq=1 – Nova Aug 02 '19 at 14:20

1 Answers1

0

From your example I do not understand what you want bold, the whole sentence or just μ? If you want the whole sentence this is an example bellow.

ggplot(mtcars,aes(x=mpg,y=cyl))+geom_count()+
  labs(y=bquote(bold(paste("THC [",mu,"g/g]"))))+
  theme(axis.title.y=element_text(face="bold"))
ggplot(mtcars,aes(x=mpg,y=cyl))+geom_count()+
  labs(y=bquote(bold(paste("THC [",mu,"g/g]"))))
ggplot(mtcars,aes(x=mpg,y=cyl))+geom_count()+
  labs(y=(expression(paste("THC [",mu,"g/g]"))))