ggdag (version 0.1.0)

ggdag: Quickly plot a DAG in ggplot2

Description

ggdag() is a wrapper to quickly plot DAGs.

Usage

ggdag(.tdy_dag, ..., edge_type = "link_arc", node_size = 16,
  text_size = 3.88, label_size = text_size, text_col = "white",
  label_col = "black", node = TRUE, stylized = TRUE, text = TRUE,
  use_labels = NULL)

Arguments

.tdy_dag

input graph, an object of class tidy_dagitty or dagitty

...

additional arguments passed to tidy_dagitty()

edge_type

a character vector, the edge geom to use. One of: "link_arc", which accounts for directed and bidirected edges, "link", "arc", or "diagonal"

node_size

size of DAG node

text_size

size of DAG text

label_size

size of label text

text_col

color of DAG text

label_col

color of label text

node

logical. Should nodes be included in the DAG?

stylized

logical. Should DAG nodes be stylized? If so, use geom_dag_nodes and if not use geom_dag_point

text

logical. Should text be included in the DAG?

use_labels

a string. Variable to use for geom_dag_repel_label(). Default is NULL.

Value

a ggplot

See Also

ggdag_classic()

Examples

Run this code
# NOT RUN {
dag  <- dagify(y ~ x + z2 + w2 + w1,
  x ~ z1 + w1,
  z1 ~ w1 + v,
  z2 ~ w2 + v,
  w1 ~~ w2)

ggdag(dag)
ggdag(dag) + theme_dag_blank()

ggdag(dagitty::randomDAG(5, .5))

# }

Run the code above in your browser using DataCamp Workspace