0

When parse = FALSE the annotation (see reprex below) appears in bold, as expected since fontface = "bold"; however, when parse = TRUE the annotation no longer appears in bold. Can anyone suggest a fix for this please?

library(ggplot2)

df <- data.frame(
  a = c(1, 2),
  b = c(1, 2)
)

mean <- mean(df$a)
stdev <- sd(df$a)

f <- paste0(mean, '* "±" * ', stdev, ' ~ "kg" * "\U00B7" * yr^-1')

ggplot(df) +
  annotate(
    "text",
    x = 55,
    y = 43.2,
    label = f,
    fontface = "bold",
    parse = FALSE
  )

Original reprex from Adding a value to an expression and pasting it in ggplot2 with annotate ; thanks to Stefan.

PhelsumaFL
  • 61
  • 8
  • Note [Change geom_text to bold when parse=TRUE](https://stackoverflow.com/questions/43728261/change-geom-text-to-bold-when-parse-true) – benson23 Mar 03 '23 at 15:32

0 Answers0