tests/testthat/test-layout_manipulate.R

test_that("layout_manipulate works", {
  xy <- cbind(c(0, 0, 0, 0), c(1, 2, 3, 4))
  xynew <- layout_mirror(
    layout_mirror(xy, axis = "horizontal"),
    axis = "horizontal"
  )
  expect_true(all(xynew == xy))
  xynew <- layout_mirror(
    layout_mirror(xy, axis = "vertical"),
    axis = "vertical"
  )
  expect_true(all(xynew == xy))

  expect_error(layout_mirror(xy, "diagonal"))
  expect_error(layout_mirror(c(1, 1), "horizontal"))

  expect_equal(layout_rotate(xy, 180)[, 2], c(-1, -2, -3, -4))
  expect_error(layout_rotate(c(1, 1), 70))
  expect_error(layout_rotate(xy, "70"))
})

Try the graphlayouts package in your browser

Any scripts or data that you put into this service are public.

graphlayouts documentation built on Feb. 21, 2026, 9:06 a.m.