fix: as tibble to allow single variable plotting

This commit is contained in:
Andreas Gammelgaard Damsbo 2026-03-31 20:41:09 +02:00
commit 7b0692fd17
No known key found for this signature in database

View file

@ -22,18 +22,24 @@ plot_likert <- function(data,
ds <- list(data) ds <- list(data)
} }
out <- lapply(ds, \(.x) { out <- lapply(ds, \(.x) {
.x[c(pri, sec)] |> plot_likert_single(
# na.omit() |> data = .x,
plot_likert_single(color.palette = color.palette) include = tidyselect::any_of(c(pri, sec)),
color.palette = color.palette
)
}) })
wrap_plot_list(out, title = glue::glue(i18n$t("Grouped by {get_label(data,ter)}"))) wrap_plot_list(out, title = glue::glue(i18n$t("Grouped by {get_label(data,ter)}")))
} }
plot_likert_single <- function(data, color.palette = "viridis") { plot_likert_single <- function(data,
ggstats::gglikert(data = data) + include = dplyr::everything(),
scale_fill_generate(palette=color.palette)+ color.palette = "viridis") {
data |>
dplyr::as_tibble() |>
ggstats::gglikert(include = include) +
scale_fill_generate(palette = color.palette) +
ggplot2::theme( ggplot2::theme(
# legend.position = "none", # legend.position = "none",
# panel.grid.major = element_blank(), # panel.grid.major = element_blank(),