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")
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")
Comments
Post a Comment