Specify attributes for a single arrowhead or a pair of source and target arrowheads
Source:R/arrowhead.R
d2_arrowhead.Rdd2_arrowhead() specifies the label, shape, and fill for a source or target
arrowhead. d2_arrowheads() allows the specification of both a source and
target arrowhead.
Arguments
- shape
See
d2r::keys_d2[["arrowhead"]]for allowed shape values.- type
Type of arrowhead: "target" or "source".
- label
Short arrowhead label.
- filled
Must be
NULLor logical. Ignored if shape is"arrow"or a crow's foot shape (any shape starting with"cf-").- ...
Named parameters used to set values for both the source and target arrowheads.
- target, source
Named list of arguments (excluding type) passed to
d2_arrowhead().- id
D2 diagram map identifier. All other container or map attributes are recycled to match the length of
idusingvctrs::vec_recycle_common()
Examples
d2_arrowhead(
shape = "cf-many-required",
label = "Many required"
)
#> [1] "target-arrowhead: Many required {\nshape: cf-many-required\n}"
example_diagram <- "A -> B"
d2_arrowheads(
shape = "triangle",
id = example_diagram,
filled = FALSE
)
#> [1] "A -> B: {\n source-arrowhead: {\nstyle.filled: false\n}\ntarget-arrowhead: {\nstyle.filled: false\n}\n}"
d2_arrowheads(
source = list(
shape = "triangle",
label = "source",
filled = FALSE
),
target = list(
shape = "circle",
filled = TRUE
),
id = example_diagram
)
#> [1] "A -> B: {\n source-arrowhead: source {\nstyle.filled: false\n}\ntarget-arrowhead: {\nshape: circle\nstyle.filled: true\n}\n}"