mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2026-06-19 12:37:30 +02:00
fix: as tibble to allow single variable plotting
This commit is contained in:
parent
75f2ae07b7
commit
7b0692fd17
1 changed files with 12 additions and 6 deletions
|
|
@ -22,17 +22,23 @@ 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(),
|
||||||
|
color.palette = "viridis") {
|
||||||
|
data |>
|
||||||
|
dplyr::as_tibble() |>
|
||||||
|
ggstats::gglikert(include = include) +
|
||||||
scale_fill_generate(palette = color.palette) +
|
scale_fill_generate(palette = color.palette) +
|
||||||
ggplot2::theme(
|
ggplot2::theme(
|
||||||
# legend.position = "none",
|
# legend.position = "none",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue