Skip to content

Commit

Permalink
use_nodes for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
malcolmbarrett committed Sep 2, 2023
1 parent c97d406 commit 4228b8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions R/geom_dag.R
Original file line number Diff line number Diff line change
Expand Up @@ -797,12 +797,12 @@ geom_dag <- function(size = 1, edge_type = c("link_arc", "link", "arc", "diagona
label_size = text_size,
text_col = "white", label_col = "black",
edge_width = 0.6, edge_cap = 8, arrow_length = 5,
use_node = TRUE, use_stylized = FALSE, use_text = TRUE,
use_nodes = TRUE, use_stylized = FALSE, use_text = TRUE,
use_labels = FALSE, label = NULL, text = NULL, node = deprecated(),
stylized = deprecated()) {
if (is_present(node)) {
deprecate_soft("0.3.0", "geom_dag(node)", "geom_dag(use_node)")
use_node <- node
deprecate_soft("0.3.0", "geom_dag(node)", "geom_dag(use_nodes)")
use_nodes <- node
}

if (is_present(stylized)) {
Expand Down Expand Up @@ -842,12 +842,14 @@ geom_dag <- function(size = 1, edge_type = c("link_arc", "link", "arc", "diagona
arrow = grid::arrow(length = grid::unit(sizes[["arrow"]], "pt"), type = "closed") )
}

if (isTRUE(use_node)) {
if (isTRUE(use_nodes)) {
if (isTRUE(use_stylized)) {
node_geom <- geom_dag_node(size = sizes[["node"]])
} else {
node_geom <- geom_dag_point(size = sizes[["node"]])
}
} else {
node_geom <- NULL
}

text <- rlang::enquo(text)
Expand Down
4 changes: 2 additions & 2 deletions R/ggdag.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ggdag <- function(.tdy_dag, ..., size = 1, edge_type = "link_arc", node_size = 1
label_size = text_size,
text_col = "white", label_col = "black",
edge_width = 0.6, edge_cap = 8, arrow_length = 5,
use_node = TRUE, use_stylized = FALSE, use_text = TRUE,
use_nodes = TRUE, use_stylized = FALSE, use_text = TRUE,
use_labels = FALSE, text = NULL, label = NULL,
node = deprecated(), stylized = deprecated()) {

Expand All @@ -60,7 +60,7 @@ ggdag <- function(.tdy_dag, ..., size = 1, edge_type = "link_arc", node_size = 1
edge_width = edge_width,
edge_cap = edge_cap,
arrow_length = arrow_length,
use_node = use_node,
use_nodes = use_nodes,
use_stylized = use_stylized,
use_text = use_text,
use_labels = use_labels,
Expand Down

0 comments on commit 4228b8e

Please sign in to comment.