diff --git a/DESCRIPTION b/DESCRIPTION
index f58bf5ef3..fea9afb6a 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
Type: Package
Package: see
Title: Model Visualisation Toolbox for 'easystats' and 'ggplot2'
-Version: 0.8.5.3
+Version: 0.8.5.4
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
diff --git a/R/plot.check_dag.R b/R/plot.check_dag.R
index 8528790dd..bf6e8a5d7 100644
--- a/R/plot.check_dag.R
+++ b/R/plot.check_dag.R
@@ -143,8 +143,13 @@ plot.see_check_dag <- function(x,
ggplot2::ggtitle("Required model")
if (which == "all") {
- # fix legends
- plot2 <- plot2 + ggplot2::theme(legend.position = "none")
+ # fix legends - remove the legend that has fewer items, so all items
+ # in the legend are shown for the integrated plot
+ if (insight::n_unique(p1$data$type) > insight::n_unique(p2$data$type)) {
+ plot2 <- plot2 + ggplot2::theme(legend.position = "none")
+ } else {
+ plot1 <- plot1 + ggplot2::theme(legend.position = "none")
+ }
# plot
plots(plot1, plot2, n_rows = 1)
} else if (which == "current") {
diff --git a/tests/testthat/_snaps/plot.check_dag/plot-check-dag-all-adjusted.svg b/tests/testthat/_snaps/plot.check_dag/plot-check-dag-all-adjusted.svg
new file mode 100644
index 000000000..6e37f1608
--- /dev/null
+++ b/tests/testthat/_snaps/plot.check_dag/plot-check-dag-all-adjusted.svg
@@ -0,0 +1,121 @@
+
+
diff --git a/tests/testthat/_snaps/plot.check_dag/plot-check-dag-all.svg b/tests/testthat/_snaps/plot.check_dag/plot-check-dag-all.svg
new file mode 100644
index 000000000..dbf6253e3
--- /dev/null
+++ b/tests/testthat/_snaps/plot.check_dag/plot-check-dag-all.svg
@@ -0,0 +1,121 @@
+
+
diff --git a/tests/testthat/_snaps/plot.check_dag/plot-check-dag-current-adjusted.svg b/tests/testthat/_snaps/plot.check_dag/plot-check-dag-current-adjusted.svg
new file mode 100644
index 000000000..78cd3603d
--- /dev/null
+++ b/tests/testthat/_snaps/plot.check_dag/plot-check-dag-current-adjusted.svg
@@ -0,0 +1,61 @@
+
+
diff --git a/tests/testthat/_snaps/plot.check_dag/plot-check-dag-current.svg b/tests/testthat/_snaps/plot.check_dag/plot-check-dag-current.svg
new file mode 100644
index 000000000..1240a0c9a
--- /dev/null
+++ b/tests/testthat/_snaps/plot.check_dag/plot-check-dag-current.svg
@@ -0,0 +1,59 @@
+
+
diff --git a/tests/testthat/_snaps/plot.check_dag/plot-check-dag-required-adjusted.svg b/tests/testthat/_snaps/plot.check_dag/plot-check-dag-required-adjusted.svg
new file mode 100644
index 000000000..b013feb55
--- /dev/null
+++ b/tests/testthat/_snaps/plot.check_dag/plot-check-dag-required-adjusted.svg
@@ -0,0 +1,61 @@
+
+
diff --git a/tests/testthat/_snaps/plot.check_dag/plot-check-dag-required.svg b/tests/testthat/_snaps/plot.check_dag/plot-check-dag-required.svg
new file mode 100644
index 000000000..b013feb55
--- /dev/null
+++ b/tests/testthat/_snaps/plot.check_dag/plot-check-dag-required.svg
@@ -0,0 +1,61 @@
+
+
diff --git a/tests/testthat/test-plot.check_dag.R b/tests/testthat/test-plot.check_dag.R
new file mode 100644
index 000000000..36b39d5d2
--- /dev/null
+++ b/tests/testthat/test-plot.check_dag.R
@@ -0,0 +1,52 @@
+skip_if_not_installed("vdiffr")
+skip_if_not_installed("ggdag")
+
+test_that("`plot()` for check_dag", {
+ set.seed(1234)
+ dag <- performance::check_dag(
+ y ~ x + b + c,
+ x ~ b,
+ outcome = "y",
+ exposure = "x",
+ coords = list(
+ x = c(y = 5, x = 4, b = 3, c = 3),
+ y = c(y = 3, x = 3, b = 2, c = 4)
+ )
+ )
+ vdiffr::expect_doppelganger(
+ title = "plot.check_dag all",
+ fig = plot(dag)
+ )
+ vdiffr::expect_doppelganger(
+ title = "plot.check_dag current",
+ fig = plot(dag, which = "current")
+ )
+ vdiffr::expect_doppelganger(
+ title = "plot.check_dag required",
+ fig = plot(dag, which = "required")
+ )
+ set.seed(1234)
+ dag <- performance::check_dag(
+ y ~ x + b + c,
+ x ~ b,
+ outcome = "y",
+ exposure = "x",
+ adjusted = "b",
+ coords = list(
+ x = c(y = 5, x = 4, b = 3, c = 3),
+ y = c(y = 3, x = 3, b = 2, c = 4)
+ )
+ )
+ vdiffr::expect_doppelganger(
+ title = "plot.check_dag all-adjusted",
+ fig = plot(dag)
+ )
+ vdiffr::expect_doppelganger(
+ title = "plot.check_dag current-adjusted",
+ fig = plot(dag, which = "current")
+ )
+ vdiffr::expect_doppelganger(
+ title = "plot.check_dag required-adjusted",
+ fig = plot(dag, which = "required")
+ )
+})
diff --git a/tests/vdiffr.Rout.fail b/tests/vdiffr.Rout.fail
new file mode 100644
index 000000000..906a373b0
--- /dev/null
+++ b/tests/vdiffr.Rout.fail
@@ -0,0 +1,269 @@
+Environment:
+- vdiffr-svg-engine: 2.0
+- vdiffr: 1.0.7
+
+
+Failed doppelganger: plot-check-dag-all (C:\Users\Daniel\Documents\GitHub\easystats\see\tests\testthat\_snaps/plot.check_dag/plot-check-dag-all.svg)
+
+< before
+> after
+@@ 45,13 / 45,13 @@
+
+
+<
+>
+<
+>
+
+
+
+<
+>
+<
+>
+<
+>
+<
+>
+
+
+
+
+Failed doppelganger: plot-check-dag-current (C:\Users\Daniel\Documents\GitHub\easystats\see\tests\testthat\_snaps/plot.check_dag/plot-check-dag-current.svg)
+
+< before
+> after
+@@ 26,13 / 26,13 @@
+
+
+<
+>
+<
+>
+
+
+
+<
+>
+<
+>
+<
+>
+<
+>
+
+
+@@ 51,8 / 51,10 @@
+
+
+<
+>
+>
+ outcome
+ exposure
+< unadjusted
+> adjusted
+> unadjusted
+ Current model
+
+