Closed mattansb closed 3 years ago
This works fine for me (note that the suggested syntax is below):
fit <- sem("mpg ~ cyl\nmpg ~ am", data = mtcars, meanstructure = TRUE)
g <- prepare_graph(fit)
edges(g) <- edges(g) %>%
linetype_sig("dashed")
plot(g)
Suggested syntax:
prepare_graph(fit) %>%
linetype_sig_edges("dashed") %>%
plot()
It's because all the edges are sig in your example:
library(lavaan)
#> This is lavaan 0.6-7
#> lavaan is BETA software! Please report any bugs.
library(tidySEM)
#> Registered S3 methods overwritten by 'tidySEM':
#> method from
#> print.mplus.model MplusAutomation
#> print.mplusObject MplusAutomation
#> summary.mplus.model MplusAutomation
library(magrittr)
fit <- sem("mpg ~ cyl\nmpg ~ am", data = mtcars, meanstructure = TRUE)
g <- prepare_graph(fit)
edges(g) <- edges(g) %>%
linetype_cov("dashed")
plot(g)
#> Error in grid.Call.graphics(C_lines, x$x, x$y, index, x$arrow): invalid line type: must be length 2, 4, 6 or 8
Created on 2021-03-08 by the reprex package (v1.0.0)
Pretty poor design choice on the side of ggplot to accept both numeric or character linetypes, but then to strictly enforce the type...