r - Using different font styles in annotate (ggplot2) -


i'm using code below generate simple chart annotations:

require(ggplot2); data(mtcars) ggplot(mtcars, aes(x = wt, y = mpg)) +    geom_point() +   annotate("text", x = 4, y = 25, label = "this should bold\nand not",            colour = "red") +   geom_vline(xintercept = 3.2, colour = "red") 

simple plot

on chart apply bold font first part of phrase in text annotation:

this should bold

but wish remaining part of text remain unaltered respect font face , style.

how using plotmath syntax parse = true:

ggplot(mtcars, aes(x = wt, y = mpg)) +      geom_point() +     annotate("text", x = 4, y = 25,              label = 'atop(bold("this should bold"),"this should not")',             colour = "red", parse = true) +     geom_vline(xintercept = 3.2, colour = "red") 

enter image description here


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -