Skip to contents

A function to plot a graph with nodes and edges.

Usage

GraphPlot(
  node,
  edge,
  transition = NULL,
  node_coord = c("x", "y"),
  node_group = NULL,
  node_palette = "Paired",
  node_palcolor = NULL,
  node_size = 4,
  node_alpha = 1,
  node_highlight = NULL,
  node_highlight_color = "red",
  label = FALSE,
  label.size = 3.5,
  label.fg = "white",
  label.bg = "black",
  label.bg.r = 0.1,
  label_insitu = FALSE,
  label_repel = FALSE,
  label_repulsion = 20,
  label_point_size = 1,
  label_point_color = "black",
  label_segment_color = "black",
  edge_threshold = 0.01,
  use_triangular = c("upper", "lower", "both"),
  edge_line = c("straight", "curved"),
  edge_line_curvature = 0.3,
  edge_line_angle = 90,
  edge_color = "grey40",
  edge_size = c(0.2, 1),
  edge_alpha = 0.5,
  edge_shorten = 0,
  edge_offset = 0,
  edge_highlight = NULL,
  edge_highlight_color = "red",
  transition_threshold = 0.01,
  transition_line = c("straight", "curved"),
  transition_line_curvature = 0.3,
  transition_line_angle = 90,
  transition_color = "black",
  transition_size = c(0.2, 1),
  transition_alpha = 1,
  transition_arrow_type = "closed",
  transition_arrow_angle = 20,
  transition_arrow_length = unit(0.02, "npc"),
  transition_shorten = 0.05,
  transition_offset = 0,
  transition_highlight = NULL,
  transition_highlight_color = "red",
  aspect.ratio = 1,
  title = NULL,
  subtitle = NULL,
  xlab = NULL,
  ylab = NULL,
  legend.position = "right",
  legend.direction = "vertical",
  theme_use = "theme_scp",
  theme_args = list(),
  return_layer = FALSE
)

Arguments

node

A data frame representing the nodes of the graph.

edge

A matrix representing the edges of the graph.

transition

A matrix representing the transitions between nodes.

node_coord

A character vector specifying the names of the columns in node that represent the x and y coordinates.

node_group

A character vector specifying the name of the column in node that represents the grouping of the nodes.

node_palette

A character vector specifying the name of the color palette for node groups.

node_palcolor

A character vector specifying the names of the colors for each node group.

node_size

A numeric value or column name of node specifying the size of the nodes.

node_alpha

A numeric value or column name of node specifying the transparency of the nodes.

node_highlight

A character vector specifying the names of nodes to highlight.

node_highlight_color

A character vector specifying the color for highlighting nodes.

label

A logical value indicating whether to show labels for the nodes.

label.size

A numeric value specifying the size of the labels.

label.fg

A character vector specifying the foreground color of the labels.

label.bg

A character vector specifying the background color of the labels.

label.bg.r

A numeric value specifying the background color transparency of the labels.

label_insitu

A logical value indicating whether to display the node group labels in situ or as numeric values.

label_repel

A logical value indicating whether to use force-directed label repulsion.

label_repulsion

A numeric value specifying the repulsion force for labels.

label_point_size

A numeric value specifying the size of the label points.

label_point_color

A character vector specifying the color of the label points.

label_segment_color

A character vector specifying the color for the label segments.

edge_threshold

A numeric value specifying the threshold for removing edges.

use_triangular

A character vector specifying which part of the edge matrix to use (upper, lower, both).

edge_line

A character vector specifying the type of line for edges (straight, curved).

edge_line_curvature

A numeric value specifying the curvature of curved edges.

edge_line_angle

A numeric value specifying the angle of curved edges.

edge_color

A character vector specifying the color of the edges.

edge_size

A numeric vector specifying the range of edge sizes.

edge_alpha

A numeric value specifying the transparency of the edges.

edge_shorten

A numeric value specifying the length of the edge shorten.

edge_offset

A numeric value specifying the length of the edge offset.

edge_highlight

A character vector specifying the names of edges to highlight.

edge_highlight_color

A character vector specifying the color for highlighting edges.

transition_threshold

A numeric value specifying the threshold for removing transitions.

transition_line

A character vector specifying the type of line for transitions (straight, curved).

transition_line_curvature

A numeric value specifying the curvature of curved transitions.

transition_line_angle

A numeric value specifying the angle of curved transitions.

transition_color

A character vector specifying the color of the transitions.

transition_size

A numeric vector specifying the range of transition sizes.

transition_alpha

A numeric value specifying the transparency of the transitions.

transition_arrow_type

A character vector specifying the type of arrow for transitions (closed, open).

transition_arrow_angle

A numeric value specifying the angle of the transition arrow.

transition_arrow_length

A numeric value specifying the length of the transition arrow.

transition_shorten

A numeric value specifying the length of the transition shorten.

transition_offset

A numeric value specifying the length of the transition offset.

transition_highlight

A character vector specifying the names of transitions to highlight.

transition_highlight_color

A character vector specifying the color for highlighting transitions.

aspect.ratio

A numeric value specifying the aspect ratio of the plot.

title

A character value specifying the title of the plot.

subtitle

A character value specifying the subtitle of the plot.

xlab

A character value specifying the label for the x-axis.

ylab

A character value specifying the label for the y-axis.

legend.position

A character value specifying the position of the legend.

legend.direction

A character value specifying the direction of the legend.

theme_use

A character value specifying the theme to use.

theme_args

A list of arguments to be passed to the theme.

return_layer

A logical value indicating whether to return the layers of the plot instead of the plot itself.

See also