cjvanlissa / tidySEM

55 stars 7 forks source link

avoid overlapping labels #16

Closed mattansb closed 3 years ago

mattansb commented 3 years ago

Is there any way to shift the labels along the edges?

In this example, they are overlapping and only one can be seen:

library(tidySEM)
library(lavaan)

mod <- "
mpg ~ am + cyl
hp ~ am + cyl
"

fit <- sem(mod, data = mtcars)

lay <- get_layout(
  "cyl", "mpg",
  NA, NA,
  "am", "hp",
  rows = 3
)

graph_sem(fit, layout = lay)

Created on 2021-03-02 by the reprex package (v1.0.0)

cjvanlissa commented 3 years ago

Yes, using the argument label_location. Is this not documented?

Bwt, could you get in touch with me on c.j.vanlissa at uu dot nl? I have added new experimental features for standard editing jobs, like making all non-significant paths gray, or removing all variance arrows, etc. I'm not ready to release this version, but perhaps you might be interested in testing it!

cjvanlissa commented 3 years ago

E.g.

library(tidySEM)
library(lavaan)
library(dplyr)

mod <- "
mpg ~ am + cyl
hp ~ am + cyl
"

fit <- sem(mod, data = mtcars)

lay <- get_layout(
  "cyl", "mpg",
  NA, NA,
  "am", "hp",
  rows = 3
)

prepare_graph(fit, layout = lay) %>%
  hide_var() %>%
  hide_fixed() %>%
  edit_graph({label_location = .2}) %>%
  plot()

image

mattansb commented 3 years ago

Ohh... that looks cool!

Thanks!