Skip to content

Commit 9fe3cc1

Browse files
authored
Allow to add global aes when plotting visualisation_recipe() (#383)
* Allow to add global aes when plotting `visualosation_recipe()` * version
1 parent f1bd98d commit 9fe3cc1

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: see
33
Title: Model Visualisation Toolbox for 'easystats' and 'ggplot2'
4-
Version: 0.10.0
4+
Version: 0.10.0.2
55
Authors@R:
66
c(person(given = "Daniel",
77
family = "Lüdecke",

R/plot.visualisation_recipe.R

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,16 @@ plot.see_visualisation_recipe <- function(x, ...) {
77
}
88
suppressWarnings(ggraph::ggraph(attributes(x)$data, layout = attributes(x)$layout) + geoms_from_list(x))
99
} else {
10-
suppressWarnings(ggplot2::ggplot(data = attributes(x)$data) +
11-
geoms_from_list(x, ...))
10+
global_aes <- attributes(x)$global_aes
11+
if (!is.null(global_aes) && length(global_aes)) {
12+
global_aes <- do.call(ggplot2::aes, args = lapply(global_aes, .str_to_sym))
13+
}
14+
suppressWarnings(
15+
do.call(
16+
ggplot2::ggplot,
17+
insight::compact_list(list(data = attributes(x)$data, mapping = global_aes))
18+
) + geoms_from_list(x, ...)
19+
)
1220
}
1321
}
1422

0 commit comments

Comments
 (0)