Selectively bold label for ggplot2::ggplot2().

labs_bold(cond, bold, nonbold)

Arguments

cond

(numeric) expected conditional variable bold(1), not to bold(0)

bold

(character) level to bold

nonbold

(character)
which level to bold.

Details

The function bold text in variable (bold) and concatenates it with string in (nonbold) and returns a dataframe.

See also

Examples

library(dplyr)
library(ggplot2)

xxx <- tribble(
  ~x, ~z, ~w, ~y,
  1, "BOLD_AA", " plain", 1,
  2, "b", "b", 0,
  3, "c", "c", 0
)
ggplot(xxx, aes_string(x = "x", y = "z")) +
  geom_point() +
  scale_y_discrete(
    label = labs_bold(cond = xxx[["y"]], xxx[["z"]], nonbold = xxx[["w"]])
  )
#> Warning: `aes_string()` was deprecated in ggplot2 3.0.0.
#>  Please use tidy evaluation idioms with `aes()`.
#>  See also `vignette("ggplot2-in-packages")` for more information.
#> [2024-08-28 08:20:50] > Dataout object from
#> the labs_bold function is created