Set domain of color explicitly in filter step, in case values got filtered out
This commit is contained in:
Родитель
dc1219dac9
Коммит
a9c3d6ddda
|
@ -130,6 +130,13 @@ prep_specs_filter <- function(.data, mapping, previous_frame, filter_operation,
|
|||
filter_operation = glue::glue_collapse(filter_operation, sep = ", "),
|
||||
within_group = ifelse(length(original_data %>% dplyr::group_vars()) > 0, " within each group", "")
|
||||
)
|
||||
|
||||
# Explicitly set color domain in case any colors got filtered out
|
||||
if ("spec" %in% names(spec)) {
|
||||
spec[["spec"]][["encoding"]][["color"]][["scale"]][["domain"]] <- spec[["spec"]][["encoding"]][["color"]][["legend"]][["values"]]
|
||||
} else {
|
||||
spec[["encoding"]][["color"]][["scale"]][["domain"]] <- spec[["encoding"]][["color"]][["legend"]][["values"]]
|
||||
}
|
||||
}
|
||||
|
||||
# IDs to filter
|
||||
|
|
Загрузка…
Ссылка в новой задаче