Skip to content

Commit

Permalink
update docs to use geom_dag()
Browse files Browse the repository at this point in the history
  • Loading branch information
malcolmbarrett committed Jan 28, 2024
1 parent c14660e commit bf5ccce
Show file tree
Hide file tree
Showing 11 changed files with 124 additions and 116 deletions.
15 changes: 1 addition & 14 deletions R/canonical.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,7 @@
#' @param .dag,.tdy_dag input graph, an object of class `tidy_dagitty` or
#' `dagitty`
#' @param ... additional arguments passed to `tidy_dagitty()`
#' @param 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"
#' @param node_size size of DAG node
#' @param text_size size of DAG text
#' @param label_size size of label text
#' @param text_col color of DAG text
#' @param label_col color of label text
#' @param node logical. Should nodes be included in the DAG?
#' @param stylized logical. Should DAG nodes be stylized? If so, use
#' `geom_dag_nodes` and if not use `geom_dag_point`
#' @param text logical. Should text be included in the DAG?
#' @param use_labels a string. Variable to use for `geom_dag_label_repel()`.
#' Default is `NULL`.
#' @inheritParams geom_dag
#'
#' @return a `tidy_dagitty` that includes L or a `ggplot`
#' @export
Expand Down
15 changes: 1 addition & 14 deletions R/drelationship.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,13 @@
#' @param .tdy_dag input graph, an object of class `tidy_dagitty` or
#' `dagitty`
#' @param ... additional arguments passed to `tidy_dagitty()`
#' @param 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"
#' @param from a character vector, the starting variable (must by in DAG). If
#' `NULL`, checks DAG for exposure variable.
#' @param to a character vector, the ending variable (must by in DAG). If
#' `NULL`, checks DAG for outcome variable.
#' @param controlling_for a character vector, variables in the DAG to control
#' for.
#' @param node_size size of DAG node
#' @param text_size size of DAG text
#' @param label_size size of label text
#' @param text_col color of DAG text
#' @param label_col color of label text
#' @param node logical. Should nodes be included in the DAG?
#' @param stylized logical. Should DAG nodes be stylized? If so, use
#' `geom_dag_nodes` and if not use `geom_dag_point`
#' @param text logical. Should text be included in the DAG?
#' @param use_labels a string. Variable to use for `geom_dag_label_repel()`.
#' Default is `NULL`.
#' @inheritParams geom_dag
#' @param collider_lines logical. Should the plot show paths activated by
#' adjusting for a collider?
#' @param as_factor logical. Should the `d_relationship` variable be a
Expand Down
5 changes: 3 additions & 2 deletions R/geom_dag.R
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,7 @@ geom_dag_collider_edges <- function(mapping = NULL, data = NULL,
#' DAG aesthetics and any user-specified aesthetics.
#'
#' @examples
#' library(ggplot2)
#' confounder_triangle() %>%
#' dag_adjustment_sets() %>%
#' ggplot(dag_aes(color = adjusted)) +
Expand Down Expand Up @@ -821,7 +822,7 @@ dag_aes <- function(...) {
#' default, edges, nodes, and text). While the underlying layers, all available
#' in ggdag, are true geoms, we usually need a consistent set of layers to make
#' a DAG. `geom_dag()` provides this. Because `geom_dag()` is not a true geom,
#' you'll find that it is awkward for sophiticated customizations. When you hit
#' you'll find that it is awkward for sophisticated customization. When you hit
#' that point, you should use the underlying geoms directly.
#'
#' @param size A numeric value scaling the size of all elements in the DAG. This
Expand Down Expand Up @@ -852,7 +853,7 @@ dag_aes <- function(...) {
#'
#' @examples
#' # Basic usage with ggdag
#' library(ggdag)
#' library(ggplot2)
#' dag <- dagify(y ~ x, z ~ y)
#' ggplot(dag, dag_aes()) + geom_dag()
#' ggplot(dag, dag_aes()) + geom_dag(size = 1.5)
Expand Down
15 changes: 1 addition & 14 deletions R/ggdag.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,7 @@
#' @param .tdy_dag input graph, an object of class `tidy_dagitty` or
#' `dagitty`
#' @param ... additional arguments passed to `tidy_dagitty()`
#' @param 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"
#' @param node_size size of DAG node
#' @param text_size size of DAG text
#' @param label_size size of label text
#' @param text_col color of DAG text
#' @param label_col color of label text
#' @param node logical. Should nodes be included in the DAG?
#' @param stylized logical. Should DAG nodes be stylized? If so, use
#' `geom_dag_nodes` and if not use `geom_dag_point`
#' @param text logical. Should text be included in the DAG?
#' @param use_labels a string. Variable to use for `geom_dag_label_repel()`.
#' Default is `NULL`.
#' @inheritParams geom_dag
#'
#' @return a `ggplot`
#' @export
Expand Down
15 changes: 1 addition & 14 deletions R/quick_plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,7 @@
#'
#' @param x,y,a,b,m,z Character vector. Optional label. Default is `NULL`
#' @param x_y_associated Logical. Are x and y associated? Default is `FALSE`.
#' @param 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"
#' @param node_size size of DAG node
#' @param text_size size of DAG text
#' @param label_size size of label text
#' @param text_col color of DAG text
#' @param label_col color of label text
#' @param node logical. Should nodes be included in the DAG?
#' @param stylized logical. Should DAG nodes be stylized? If so, use
#' `geom_dag_nodes` and if not use `geom_dag_point`
#' @param text logical. Should text be included in the DAG?
#' @param use_labels a string. Variable to use for `geom_dag_label_repel()`.
#' Default is `NULL`.
#' @inheritParams geom_dag
#'
#' @return a DAG of class `dagitty` or a `ggplot`
#' @export
Expand Down
35 changes: 21 additions & 14 deletions man/canonicalize.Rd

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

45 changes: 31 additions & 14 deletions man/d_relationship.Rd

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

1 change: 1 addition & 0 deletions man/dag_aes.Rd

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

4 changes: 2 additions & 2 deletions man/geom_dag.Rd

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

45 changes: 31 additions & 14 deletions man/ggdag.Rd

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

45 changes: 31 additions & 14 deletions man/quick_plot.Rd

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

0 comments on commit bf5ccce

Please sign in to comment.