geom_dag_label | R Documentation |
Node text labels
geom_dag_label(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
parse = FALSE,
nudge_x = 0,
nudge_y = 0,
check_overlap = FALSE,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this
layer, either as a |
position |
Position adjustment, either as a string, or the result of
a call to a position adjustment function. Cannot be jointly specified with
|
... |
Other arguments passed on to |
parse |
If |
nudge_x , nudge_y |
Horizontal and vertical adjustment to nudge labels by.
Useful for offsetting text from points, particularly on discrete scales.
Cannot be jointly specified with |
check_overlap |
If |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
geom_dag_label
understand the following aesthetics (required aesthetics are in bold):
x
y
label
alpha
angle
colour
family
fontface
group
hjust
lineheight
size
vjust
library(ggplot2)
library(ggraph)
g <- dagify(m ~ x + y, y ~ x)
ggdag(g, text = FALSE) + geom_dag_label()
g %>%
tidy_dagitty() %>%
ggplot(aes(x = x, y = y, xend = xend, yend = yend)) +
geom_dag_edges(aes(
start_cap = label_rect(name, padding = margin(2.5, 2.5, 2.5, 2.5, "mm")),
end_cap = label_rect(name, padding = margin(2.5, 2.5, 2.5, 2.5, "mm"))
)) +
geom_dag_label(size = 5, fill = "black", color = "white") +
theme_dag()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.