Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add manual text colouring #128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shirdekel
Copy link

Useful when plot.percents = TRUE and bar colours require different text colours (e.g., dark grey bar needs white text and yellow bar needs black text)

Example:

library(likert)
data(pisaitems)
items29 <- pisaitems[, substr(names(pisaitems), 1, 5) == "ST25Q"]
names(items29) <- c(
  "Magazines", "Comic books", "Fiction",
  "Non-fiction books", "Newspapers"
)
l29 <- likert(items29)
plot(
  l29,
  plot.percents = TRUE,
  plot.percent.low = FALSE,
  plot.percent.high = FALSE,
  plot.percent.neutral = FALSE,
  text.color.manual.pos = c("blue", "white") |>
    rep(5),
  text.color.manual.neg = c("purple", "pink") |>
    rep(5),
  text.color.manual.neutral = c("brown") |>
    rep(5)
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant