Learn R Programming

henna (version 0.7.5)

networkPlot: Plot graph with the option of using different colors for connected components

Description

This function plots the graph of the data frame and optionally uses different colors for nodes belonging to different connected components.

Usage

networkPlot(
  df,
  title = NULL,
  numCol = NULL,
  numColType = c("weights", "ranks"),
  nodeSize = 10,
  nodeTextSize = 2.3,
  palette = "grDevices::Spectral",
  nodeColor = NULL,
  edgeWidth = 1,
  edgeColor = "black",
  edgeScales = c(0.2, 0.6),
  ...
)

Value

An object of class ggraph.

Arguments

df

Data frame.

title

Plot title.

numCol

Name of the numeric column used to vary edge widths. If no such column is provided, set to NULL.

numColType

The type of the numeric column used to vary edge widths. Choose between 'weights' and 'ranks' Ignored if numCol is NULL.

nodeSize

Size of graph nodes.

nodeTextSize

Size of text on graph nodes.

palette

grDevices palette used for coloring nodes. Ignored if nodeColor is not NULL.

nodeColor

Color used for nodes. Default is NULL (palette will instead be used).

edgeWidth

Width to be used for all edges before scaling if numCol is NULL; otherwise ignored.

edgeColor

Color used for edges.

edgeScales

Edge width scales. Must be a numeric vector of size 2 (minimum and maximum).

...

Additional arguments passed to centerTitle.

Examples

Run this code
df <- data.frame(gene1 = paste0('G', c(1, 2, 5, 6, 7, 17)),
gene2 = paste0('G', c(2, 5, 8, 11, 11, 11)),
rank = c(1, 1, 3, 3, 3, 3))
networkPlot(df, numCol='rank', numColType='ranks')

Run the code above in your browser using DataLab