cnetplot: category-item network plot

View source: R/AllGenerics.r

cnetplotR Documentation

category-item network plot

Description

category-item network plot

Usage

cnetplot(
  x,
  layout = igraph::layout_nicely,
  showCategory = 5,
  color_category = "#E5C494",
  size_category = 1,
  color_item = "#B3B3B3",
  size_item = 1,
  color_edge = "grey",
  size_edge = 0.5,
  categorySizeBy = ~itemNum,
  node_label = "all",
  node_label_size = NULL,
  foldChange = NULL,
  fc_threshold = NULL,
  hilight = "none",
  hilight_alpha = 0.3,
  ...
)

## S3 method for class 'list'
cnetplot(
  x,
  layout = "nicely",
  showCategory = 5,
  color_category = "#E5C494",
  size_category = 1,
  color_item = "#B3B3B3",
  size_item = 1,
  color_edge = "grey",
  size_edge = 0.5,
  categorySizeBy = ~itemNum,
  node_label = "all",
  node_label_size = NULL,
  foldChange = NULL,
  fc_threshold = NULL,
  hilight = "none",
  hilight_alpha = 0.3,
  ...
)

Arguments

x

input object

layout

network layout

showCategory

categories to display. Use a single number to show the first n categories, a numeric vector to select categories by index (for example, c(1, 10, 53)), or a character vector to select categories by name.

color_category

color of category node

size_category

relative size of the category

color_item

color of item node

size_item

relative size of the item (e.g., genes)

color_edge

color of edge, e.g., "black". If color = "category", then edges will be colored based on the category information.

size_edge

relative size of edge

categorySizeBy

An expression (e.g., itemNum, p.adjust) or a formula (e.g., ~ -log10(p.adjust)) to set the category node size.

node_label

one of 'all', 'none', 'category', 'item', 'exclusive' or 'share'

node_label_size

size of the node label text. When NULL (default) the built-in label size is used.

foldChange

numeric values to color the item (e.g, foldChange of gene expression values)

fc_threshold

threshold for absolute fold change to filter items

hilight

selected category to be highlighted

hilight_alpha

transparent value for not selected to be highlight

...

additional parameters. One important parameter is 'curvature' (default is 0), which can be used to curve the edges (e.g., curvature = 0.2). For circular layouts, this uses a cubic Bezier arc layer with the same radial control-point geometry as the former ggraph::geom_edge_arc() implementation. In circular mode, any non-zero curvature enables this arc layer; the arc geometry is intentionally kept compatible with the former backend.

Details

For list input, showCategory accepts either a single integer for the first n categories, a numeric vector of category indices, or a character vector of category names.

Examples

x <- list(A = letters[1:10], B = letters[5:12])
attr(x, "p.adjust") <- c(A = 0.01, B = 0.2)
p <- cnetplot(x, node_label = "none", categorySizeBy = ~ -log10(p.adjust))
p <- cnetplot(x, showCategory = c(1, 2))

ggtangle documentation built on Oct. 10, 2026, 9:06 a.m.