edge_aes: Insert edge aesthetic attributes during edge creation

Description Usage Arguments Examples

View source: R/edge_aes.R

Description

This helper function should be invoked to provide values for the namesake edge_aes argument, which is present in any function where edges are created.

Usage

1
2
3
4
5
6
7
8
9
edge_aes(style = NULL, penwidth = NULL, color = NULL, arrowsize = NULL,
  arrowhead = NULL, arrowtail = NULL, fontname = NULL, fontsize = NULL,
  fontcolor = NULL, len = NULL, tooltip = NULL, URL = NULL,
  label = NULL, labelfontname = NULL, labelfontsize = NULL,
  labelfontcolor = NULL, labeltooltip = NULL, labelURL = NULL,
  edgetooltip = NULL, edgeURL = NULL, dir = NULL, headtooltip = NULL,
  headURL = NULL, headclip = NULL, headlabel = NULL, headport = NULL,
  tailtooltip = NULL, tailURL = NULL, tailclip = NULL, taillabel = NULL,
  tailport = NULL, decorate = NULL)

Arguments

style

the edge line style. The style types that can be used are solid, bold, dashed, dotted, tapered, and invisible.

penwidth

the thickness of the stroke line for the edge itself.

color

the color of the edge. Can be an X11 color or a hexadecimal color code.

arrowsize

a scaling factor for arrowheads. The default value is 1.0 and the minimum is 0.

arrowhead

the type of arrowhead to use. The style attribute can either any of these types: normal, vee, tee, dot, diamond, box, curve, icurve, inv, crow, or none.

arrowtail

the type of arrowtail to use. The style attribute can either any of these types: normal, vee, tee, dot, diamond, box, curve, icurve, inv, crow, or none.

fontname

the name of the system font that will be used for any edge text.

fontsize

the point size of the font used for any edge text.

fontcolor

the color used for any edge text. Can be an X11 color or a hexadecimal color code.

len

the preferred edge length for an edge, in inches. Default value is 1.0.

tooltip

text for a tooltip that appears when hovering over an edge. If text is not provided, then the default tooltip text will provide the edge definition (i.e., [id]->[id] or [id]--[id]).

URL

a URL to associate with an edge. Upon rendering the plot, clicking edges with any associated URLs will open the URL in the default browser.

label

the label text associated with the edge. This text will appear near the center of the edge.

labelfontname

the name of the system font that will be used for the headlabel and the taillabel label text. If not set, the fontname value will instead be used.

labelfontsize

the point size of the font used for the headlabel and the taillabel label text. If not set, the fontsize value will instead be used.

labelfontcolor

the color used for the label text of the headlabel and the taillabel label text. If not set, the fontcolor value will instead be used. Can be an X11 color or a hexadecimal color code.

labeltooltip

text for a tooltip that will appear when hovering over the main label of an edge (if label text provided in the label edge attribute). If text is not provided and an edge label is visible, then the default tooltip text will provide the edge definition (i.e., [id]->[id] or [id]--[id]).

labelURL

a URL to associate with edge label text. Upon rendering the plot, clicking edge labels with any associated URLs will open the URL in the default browser.

edgetooltip

this option provides a means to specify a tooltip with only the non-label parts of an edge. If this is defined, the value overrides any tooltip defined for the edge. This tooltip text is when hovering along the edge (even near the head or tail node) unless overridden by a headtooltip or tailtooltip value.

edgeURL

this option provides a means to specify a URL with only the non-label parts of an edge. If this is defined, the value overrides any URL defined for the edge. This URL is used along the edge (even near the head or tail node) unless overridden by a headURL or tailURL value.

dir

an optional direction type. Normally, for directed graphs, this is forward and needn't be set. For undirected graphs, this would be none and again no explicit setting is required. However, one can also use the back or both options. The back option draws an arrowhead in the reverse direction of an edge. The both option draws two arrowheads. When using any of these options in such an explicit manner, the head... and tail... edge attributes allow control over aesthetic edge attributes in either side of the edge.

headtooltip

this option provides a means to specify a tooltip that can be displayed by hovering over the part of an edge that is adjacent to incoming node (see the tooltip argument for further details).

headURL

this option provides a means to specify a URL that can be accessed by clicking the part of an edge that is adjacent to incoming node (see the URL argument for further details).

headclip

if TRUE (the default behavior), then the head of the affected edge is clipped to the node boundary. Using FALSE places the head of the outgoing edge at the center of its node.

headlabel

this option provides a means to display a label near the part of an edge that is adjacent to incoming node (see the label argument for further details).

headport

allows one to specify which compass position on the incoming node the head of the edge will alight. Options are n, ne, e, se, s, sw, w, and nw.

tailtooltip

this option provides a means to specify a tooltip that can be displayed by hovering over the part of an edge that is adjacent to outgoing node (see the tooltip argument for further details).

tailURL

this option provides a means to specify a URL that can be accessed by clicking the part of an edge that is adjacent to outgoing node (see the URL argument for further details).

tailclip

if TRUE (the default behavior), then the tail of the affected edge is clipped to the node boundary. Using FALSE places the tail of the outgoing edge at the center of its node.

taillabel

this option provides a means to display a label near the part of an edge that is adjacent to outgoing node (see the label argument for further details).

tailport

allows one to specify which compass position on the outgoing node the tail of the edge will be emitted from. Options are n, ne, e, se, s, sw, w, and nw.

decorate

if TRUE then attach any edge label to the edge line via a 2-segment polyline, underlining the label text and partially overlapping the edge line.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Create a new graph and add
# a path with several edge
# aesthetic attributes
graph <-
  create_graph() %>%
  add_path(
    n = 3,
    type = "path",
    edge_aes = edge_aes(
      style = "dot",
      color = c("red", "blue")))

# View the graph's internal
# node data frame; the node
# aesthetic attributes have
# been inserted
graph %>%
  get_edge_df()

DiagrammeR documentation built on March 18, 2018, 1:25 p.m.