-3

I have a ggplot with on the x-scale the numbers from 0 to 21. I want the numbers 0,4,6,9,12,16,18 and 21 in bold, the rest has to stay like it is normal (grey, not bold)

How do I do that?

Jongware
  • 22,200
  • 8
  • 54
  • 100

1 Answers1

1

Here's an example:

labels <- 1:5
highlight <- c(1, 3, 5)
ggplot(data.frame(x=1:5, y=1:5), aes(x=x, y=y)) + 
  geom_point() + 
  theme(axis.text.x=
          element_text(face=ifelse(labels %in% highlight, "bold", "plain"), 
                      colour=ifelse(labels %in% highlight, "blue", "grey50"), size=25))

enter image description here

tonytonov
  • 25,060
  • 16
  • 82
  • 98