Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
branches: [main, master, devel]

name: R-CMD-check

Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: semptools
Title: Customizing Structural Equation Modelling Plots
Version: 0.3.3.19
Version: 0.4.0
Authors@R: c(
person(given = "Shu Fai",
family = "Cheung",
Expand Down
185 changes: 94 additions & 91 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,108 +1,35 @@
# semptools 0.3.3.19
# semptools 0.4.0

## Improvement

- Updated `set_edge_attribute()` to
skip edges not in a plot, without
throwing an error.
(0.3.3.2)

- Added the argument `check_direction`
to `set_edge_attribute()` and related
functions. If set to `FALSE`, then
the direction of an edge will be ignored.
That is, both `y ~ x` and `y ~~ x` will
denote edges
`y <- x`, `y -> x`, and `y <-> x`.
(0.3.3.3)

- Updated `add_rsq()`, `mark_se()`,
`mark_ci()`, and `mark_sig()` to store
the fit object in the plot. When `object`
is not set but has been stored in a plot,
these functions will retrieve the stored
fit object. This makes it not necessary
to supply the same fit object in all
calls to these functions.
(0.3.3.4)

- Updated `layout_matrix()` to ensure
that the output always has at least
three columns.
(0.3.3.5)

- Updated `set_node_attribute()` to
set the attributes of all nodes using
one value.
(0.3.3.6)

- Updated `set_edge_attribute()` to
set the attributes of all nodes using
one value.
(0.3.3.7)
## New Features

- Added `set_node_color()`, `set_node_height()`,
`set_node_label_color()`, `set_node_label_size()`,
`set_node_shape()`, `set_node_sizes()`,
`set_node_width()`.
(0.3.3.8)

- Removed `nChar = 0` in some tests to
allow testing functions with abbreviated
names. Also revised some functions to
make them work for both the original
names of nodes and their display
names, which may be abbreviated.
(0.3.3.9)

- Updated `set_node_attribute()` to use
new helpers, so that it is easier to
work with original node names,
processed (e.g., abbreviated) node
names, and labels (converted to string,
if necessary).
(0.3.3.10)

- Updated node functions to use
`set_node_attribute()` as applicable.
(0.3.3.11)

- Added `get_node_attribute()`.
(0.3.3.12)

- Added `get_edge_attribute()`.
(0.3.3.13)

- Added `set_edge_label()` and
`set_edge_label_bg()`.
(0.3.3.14)

- Added `set_edge_line_type()`.
(0.3.3.14)

- Added the `how` argument to
`set_edge_attribute()`,
`set_node_attribute()`,
and friends (if applicable).
The default mode is `how = "ratio"`
if applicable.
(0.3.3.14)

- Added `set_edge_line_width()`.
(0.3.3.14)
`set_node_width()`,
`set_node_border_width()`,
and `set_node_border_color()`.
(0.3.3.8, 0.3.3.14)

- Added `set_edge_label_size()`.
- Added `set_edge_label()`,
`set_edge_label_bg()`,
`set_edge_line_type()`,
`set_edge_line_width()`, and
`set_edge_label_size()`.
(0.3.3.14)

- Added `set_node_border_width()`,
and `set_node_border_color()`.
(0.3.3.14)
- Added `get_node_attribute()` and
`get_edge_attribute()`.
(0.3.3.12, 0.3.3.13)

- Added `set_graph_margins()`,
`node_labels_equal_scale()`,
and `set_node_labels_equal_scale()`.
(0.3.3.15)

## Improvement

### Support for a List of `qgraph` Objects

- Updated these functions to support
a list of `qgraph` objects:
`set_edge_attribute()`,
Expand Down Expand Up @@ -151,8 +78,79 @@
`set_sem_layout()`.
(0.3.3.17)

### Updates to `set_edge_attribute()` and `set_edge_attribute()`

- Updated `set_edge_attribute()` to
skip edges not in a plot, without
throwing an error.
(0.3.3.2)

- Added the argument `check_direction`
to `set_edge_attribute()` and related
functions. If set to `FALSE`, then
the direction of an edge will be ignored.
That is, both `y ~ x` and `y ~~ x` will
denote edges
`y <- x`, `y -> x`, and `y <-> x`.
(0.3.3.3)

- Updated `set_edge_attribute()` to
set the attributes of all nodes using
one value.
(0.3.3.7)

- Updated `set_node_attribute()` to
set the attributes of all nodes using
one value.
(0.3.3.6)

- Updated `set_node_attribute()` to use
new helpers, so that it is easier to
work with original node names,
processed (e.g., abbreviated) node
names, and labels (converted to string,
if necessary).
(0.3.3.10)

- Added the `how` argument to
`set_edge_attribute()`,
`set_node_attribute()`,
and friends (if applicable).
The default mode is `how = "ratio"`
if applicable.
(0.3.3.14)

### Others

- Updated node functions to use
`set_node_attribute()` as applicable.
(0.3.3.11)

- Updated `add_rsq()`, `mark_se()`,
`mark_ci()`, and `mark_sig()` to store
the fit object in the plot. When `object`
is not set but has been stored in a plot,
these functions will retrieve the stored
fit object. This makes it not necessary
to supply the same fit object in all
calls to these functions.
(0.3.3.4)

- Updated `layout_matrix()` to ensure
that the output always has at least
three columns.
(0.3.3.5)

## Miscellaneous

- Removed `nChar = 0` in some tests to
allow testing functions with abbreviated
names. Also revised some functions to
make them work for both the original
names of nodes and their display
names, which may be abbreviated.
(0.3.3.9)

- Updated to `roxygen2` 8.0.0.
(0.3.3.1)

Expand All @@ -168,6 +166,11 @@
- Fixed a multigroup bug in `mark_sig()`.
(0.3.3.19)

- Updated some tests to work if the
`lavaan` option
`auto.cov.x` is set to `TRUE`.
(0.3.3.20)

# semptools 0.3.3

## New Features
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![R-CMD-check](https://github.com/sfcheung/semptools/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/sfcheung/semptools/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

(Version 0.3.3.19, updated on 2026-06-21, [release history](https://sfcheung.github.io/semptools/news/index.html))
(Version 0.4.0, updated on 2026-07-20, [release history](https://sfcheung.github.io/semptools/news/index.html))

# semptools <img src="man/figures/logo.png" align="right" height="150" />

Expand Down
69 changes: 48 additions & 21 deletions tests/testthat/test-set_sem_layout_single.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,22 @@ p2 <- set_sem_layout(p,
indicator_push = indicator_push,
indicator_spread = indicator_spread,
loading_position = loading_position)
e_layout <- structure(
c(-1, -1, -1, -0.166666666666667, 0, 0.166666666666667,
-0.666666666666667, 1.16666666666667, 1.16666666666667, 1.16666666666667,
1.16666666666667, 0, -0.666666666666667, 0, 0.666666666666667,
0, 0.5, 1, 1.5, 1.5, 1.5, -0.5, 0.2, 0.4, 0.6, 0.8, -0.5, 0.5,
0.5, 0.5), .Dim = c(15L, 2L)
)
if (isTRUE(lavInspect(fit_sem, "options")$auto.cov.x)) {
e_layout <- structure(
c(-1, -1, -1, -0.666666666666667, 0, -0.166666666666667,
0, 0.166666666666667, 1.16666666666667, 1.16666666666667, 1.16666666666667,
1.16666666666667, -0.666666666666667, 0, 0.666666666666667, 0,
0.5, 1, -0.5, -0.5, 1.5, 1.5, 1.5, 0.2, 0.4, 0.6, 0.8, 0.5, 0.5,
0.5), dim = c(15L, 2L))
} else {
e_layout <- structure(
c(-1, -1, -1, -0.166666666666667, 0, 0.166666666666667,
-0.666666666666667, 1.16666666666667, 1.16666666666667, 1.16666666666667,
1.16666666666667, 0, -0.666666666666667, 0, 0.666666666666667,
0, 0.5, 1, 1.5, 1.5, 1.5, -0.5, 0.2, 0.4, 0.6, 0.8, -0.5, 0.5,
0.5, 0.5), dim = c(15L, 2L)
)
}
test_that("Layout as expected", {
expect_equal(
p2$layout,
Expand All @@ -59,13 +68,22 @@ p_cha2 <- set_sem_layout(p_cha,
indicator_push = indicator_push,
indicator_spread = indicator_spread,
loading_position = loading_position)
e2_layout <- structure(
c(-1, -1, -1, -0.166666666666667, 0, 0.166666666666667,
-0.666666666666667, 1.16666666666667, 1.16666666666667, 1.16666666666667,
1.16666666666667, 0, -0.666666666666667, 0, 0.666666666666667,
0, 0.5, 1, 1.5, 1.5, 1.5, -0.5, 0.2, 0.4, 0.6, 0.8, -0.5, 0.5,
0.5, 0.5), .Dim = c(15L, 2L)
)
if (isTRUE(lavInspect(fit_sem, "options")$auto.cov.x)) {
e2_layout <- structure(
c(-1, -1, -1, -0.666666666666667, 0, -0.166666666666667,
0, 0.166666666666667, 1.16666666666667, 1.16666666666667, 1.16666666666667,
1.16666666666667, -0.666666666666667, 0, 0.666666666666667, 0,
0.5, 1, -0.5, -0.5, 1.5, 1.5, 1.5, 0.2, 0.4, 0.6, 0.8, 0.5, 0.5,
0.5), dim = c(15L, 2L))
} else {
e2_layout <- structure(
c(-1, -1, -1, -0.166666666666667, 0, 0.166666666666667,
-0.666666666666667, 1.16666666666667, 1.16666666666667, 1.16666666666667,
1.16666666666667, 0, -0.666666666666667, 0, 0.666666666666667,
0, 0.5, 1, 1.5, 1.5, 1.5, -0.5, 0.2, 0.4, 0.6, 0.8, -0.5, 0.5,
0.5, 0.5), dim = c(15L, 2L)
)
}
test_that("Layout as expected after change_node_label", {
expect_equal(
p_cha2$layout,
Expand Down Expand Up @@ -107,13 +125,22 @@ p2 <- set_sem_layout(p,
indicator_push = indicator_push,
indicator_spread = indicator_spread,
loading_position = loading_position)
e_layout <- structure(
c(-1, -1, -1, -0.166666666666667, 0, 0.166666666666667,
-0.666666666666667, 1.16666666666667, 1.16666666666667, 1.16666666666667,
1.16666666666667, 0, -0.666666666666667, 0, 0.666666666666667,
0, 0.5, 1, 1.5, 1.5, 1.5, -0.5, 0.2, 0.4, 0.6, 0.8, -0.5, 0.5,
0.5, 0.5), .Dim = c(15L, 2L)
)
if (isTRUE(lavInspect(fit_sem, "options")$auto.cov.x)) {
e_layout <- structure(
c(-1, -1, -1, -0.666666666666667, 0, -0.166666666666667,
0, 0.166666666666667, 1.16666666666667, 1.16666666666667, 1.16666666666667,
1.16666666666667, -0.666666666666667, 0, 0.666666666666667, 0,
0.5, 1, -0.5, -0.5, 1.5, 1.5, 1.5, 0.2, 0.4, 0.6, 0.8, 0.5, 0.5,
0.5), dim = c(15L, 2L))
} else {
e_layout <- structure(
c(-1, -1, -1, -0.166666666666667, 0, 0.166666666666667,
-0.666666666666667, 1.16666666666667, 1.16666666666667, 1.16666666666667,
1.16666666666667, 0, -0.666666666666667, 0, 0.666666666666667,
0, 0.5, 1, 1.5, 1.5, 1.5, -0.5, 0.2, 0.4, 0.6, 0.8, -0.5, 0.5,
0.5, 0.5), dim = c(15L, 2L)
)
}
test_that("Layout as expected", {
expect_equal(
p2$layout,
Expand Down
Loading