set_curve_edges() replaces all edge curvatures on a dagitty or
tidy_dagitty object from a data frame. Use curve_edge() to set a
single edge.
Curvature sign convention
Per-edge curvature is drawn by the ggarrow edge engine only. Set it with
edge_engine = "ggarrow" on geom_dag() and the ggdag_*() quick plots, or
globally with ggdag_options_set(edge_engine = "ggarrow"); the default
ggraph engine draws every edge with the curvature of its own edge type
and warns when it is handed a per-edge value it cannot draw.
ggarrow follows the grid::curveGrob() convention, so positive curvature
curves below (to the right of) a left-to-right edge and negative curvature
curves above it. ggdag passes the value through untouched.
A bidirected edge has no direction of its own, so ggdag draws it from the
endpoint dagitty stores first. Naming its endpoints the other way round,
as in curve_edge(dag, "y", "x", 0.5) for an edge stored as x <-> y,
curves the edge to the same side of the page: the sign is flipped to match
the direction the edge is drawn in.
Examples
dag <- dagify(y ~ x + m, m ~ x)
edges <- data.frame(
from = c("x", "m"),
to = c("y", "y"),
curvature = c(0.3, -0.4)
)
dag <- set_curve_edges(dag, edges)
