1

I want to mark the text that matches "GTAAACATCCTCGACTGGAAGC" bold in my plot. What I have tried is this:

theme(axis.text.y=element_text(face=ifelse(levels(miR10b_30a$ID2)==
                                          "GTAAACATCCTCGACTGGAAGC","bold")))

It gives this error:

Error in check.length("fontface") : 'gpar' element 'fontface' must not be length 0

Any other good ways of doing this?

enter image description here

joran
  • 169,992
  • 32
  • 429
  • 468
user2300940
  • 2,355
  • 1
  • 22
  • 35

1 Answers1

2

The problem in your code is ifelse.
Here is an example that should clarify the point:

vec_fontface <- ifelse(levels(iris$Species)=="setosa","bold","plain")
ggplot(iris, aes(Species, Sepal.Length)) + geom_point() +
theme(axis.text.x=element_text(face=vec_fontface))

enter image description here

Marco Sandri
  • 23,289
  • 7
  • 54
  • 58