Skip to content

Commit

Permalink
rename plot arg
Browse files Browse the repository at this point in the history
  • Loading branch information
santikka committed Mar 19, 2024
1 parent 9218840 commit f4c0748
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
19 changes: 14 additions & 5 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ plot.dynamitefit <- function(x, parameters = NULL, type = NULL,
#' @export
#' @family plotting
#' @param x \[`dynamiteformula`]\cr The model formula.
#' @param show_deterministic \[`logical(1)`]\cr Should deterministic auxiliary
#' @param show_auxiliary \[`logical(1)`]\cr Should deterministic auxiliary
#' responses be shown in the plot? If `FALSE`, the vertices corresponding
#' to such responses will be projected out. The default is `TRUE`.
#' @param show_covariates \[`logical(1)`]\cr Should unmodeled covariates be
Expand All @@ -105,7 +105,7 @@ plot.dynamitefit <- function(x, parameters = NULL, type = NULL,
#' # TikZ format
#' plot(multichannel_formula, tikz = TRUE)
#'
plot.dynamiteformula <- function(x, show_deterministic = TRUE,
plot.dynamiteformula <- function(x, show_auxiliary = TRUE,
show_covariates = FALSE, tikz = FALSE, ...) {
stopifnot_(
!missing(x),
Expand All @@ -115,11 +115,19 @@ plot.dynamiteformula <- function(x, show_deterministic = TRUE,
is.dynamiteformula(x),
"Argument {.arg x} must be a {.cls dynamiteformula} object."
)
stopifnot_(
checkmate::test_flag(x = show_auxiliary),
"Argument {.arg show_auxiliary} must be a single {.cls logical} value."
)
stopifnot_(
checkmate::test_flag(x = show_covariates),
"Argument {.arg show_covariates} must be a single {.cls logical} value."
)
stopifnot_(
checkmate::test_flag(x = tikz),
"Argument {.arg tikz} must be a single {.cls logical} value."
)
g <- get_dag(x, project = !show_deterministic, covariates = show_covariates)
g <- get_dag(x, project = !show_auxiliary, covariates = show_covariates)
ifelse_(
tikz,
plot_dynamiteformula_tikz(g),
Expand All @@ -142,8 +150,9 @@ plot_dynamiteformula_tikz <- function(g) {
" -semithick,",
" >={Stealth[width=1.5mm,length=2mm]},",
paste0(
" obs/.style 2 args = ",
"{name = #1, circle, draw, inner sep = 5pt, label = center:$#2$}"
" obs/.style 2 args = {",
" name = #1, circle, draw, inner sep = 5pt, label = center:$#2$",
" }"
),
"}",
.parse = FALSE
Expand Down
4 changes: 2 additions & 2 deletions man/plot.dynamiteformula.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f4c0748

Please sign in to comment.