Learn R Programming

henna (version 0.3.4)

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

Description

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

Usage

networkPlot(
  df,
  title = "Network plot",
  rankCol = "rank",
  edgeScale = 2,
  nodeSize = 10,
  nodeTextSize = 2.3,
  palette = "Spectral",
  nodeColor = NULL,
  edgeColor = "black",
  ...
)

Value

An object of class ggraph.

Arguments

df

Data frame.

title

Plot title.

rankCol

Name of the rank column.

edgeScale

Scaling factor used in generating edge weights.

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).

edgeColor

Color used for edges.

...

Other 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)

Run the code above in your browser using DataLab