cg <- caugi(
A %-->% B + C,
B %-->% D,
C %-->% D,
class = "DAG"
)
plot(cg)
# Use a specific layout method (as string)
plot(cg, layout = "kamada-kawai")
# Use a layout function
plot(cg, layout = caugi_layout_sugiyama)
# Pre-compute layout and use it
coords <- caugi_layout_fruchterman_reingold(cg)
plot(cg, layout = coords)
# Bipartite layout with a function
cg_bp <- caugi(A %-->% X, B %-->% X, C %-->% Y)
partition <- c(TRUE, TRUE, TRUE, FALSE, FALSE)
plot(cg_bp, layout = caugi_layout_bipartite, partition = partition)
# Customize nodes
plot(cg, node_style = list(fill = "lightgreen", padding = 0.8))
# Customize edges by type
plot(
cg,
edge_style = list(
directed = list(col = "blue", arrow_size = 4),
undirected = list(col = "red")
)
)
# Add a title
plot(cg, main = "Causal Graph")
# Customize title
plot(
cg,
main = "My Graph",
title_style = list(fontsize = 18, col = "blue", fontface = "italic")
)
Run the code above in your browser using DataLab