Given a list with the x and y-axis coordinates for the bottom, left, top, and right of the internal text box, draws a specified shape on an existing plot.

add_node_shape(
  nd,
  shape = "box",
  shape.col = "white",
  shape.lwd = 2,
  shape.border = "black",
  shape.lty = 1,
  shape.x = NA,
  shape.y = NA,
  xpd = NA
)

Arguments

nd

A named list of vectors with the Cartesian coordinates for the bottom, left, top, and right of the internal text box for the node.

shape

The default shape for nodes, either 'box', or 'circle'.

shape.col

The fill color for the node.

shape.lwd

The line wide for the node border.

shape.border

The mode border color (NA will suppress the border).

shape.lty

The line type for the node.

shape.x

The fixed width for the x-axis.

shape.y

The fixed height for the y-axis.

xpd

A logical value or NA. If FALSE, all plotting is clipped to the plot region, if TRUE, all plotting is clipped to the figure region, and if NA, all plotting is clipped to the device region.

Examples

# Empty plot
create_base_figure()

# Named list of coordinates
nd = list(
  top = c( .5, .6 ),
  bottom = c( .5, .4 ),
  left = c( .4, .5 ),
  right = c( .6, .5 )
)

# Rectangle
add_node_shape( nd )
# Ellipse
add_node_shape(
  nd, shape = 'circle',
  shape.border = 'blue', shape.lty = 2
)