tests/testthat/test-roxytest-testexamples-add_labels.R

# Generated by roxytest: do not edit by hand!

# File R/add_labels.R: @testexamples

test_that("Function add_labels() @ L52", {
  
  # Load mutational signature
  load(system.file("extdata", "toy_mutational_signature.RData",
    package = "sigminer", mustWork = TRUE
  ))
  # Show signature profile
  p <- show_sig_profile(sig2, mode = "SBS")
  
  # Method 1
  p1 <- add_labels(p,
    x = 0.75, y = 0.3, y_end = 0.9, n_label = 3,
    labels = paste0("text", 1:3)
  )
  p1
  
  # Method 2
  p2 <- add_labels(p,
    x = c(0.15, 0.6, 0.75), y = c(0.3, 0.6, 0.9),
    labels = paste0("text", 1:3)
  )
  p2
  
  # Method 3
  sim <- get_sig_similarity(sig2)
  p3 <- add_labels(p,
    x = c(0.15, 0.6, 0.75), y = c(0.25, 0.55, 0.8),
    labels = sim, font_size = 2
  )
  p3
  expect_s3_class(p, "ggplot")
  expect_s3_class(p1, "ggplot")
  expect_s3_class(p2, "ggplot")
  expect_s3_class(p3, "ggplot")
})
ShixiangWang/sigminer documentation built on March 16, 2024, 12:30 p.m.