Skip to contents

A modern, extensible network visualization package that provides high-quality static network plots and ggplot2 conversions. cograph accepts adjacency matrices, edge lists, igraph, statnet network, qgraph and tna objects and offers customizable layouts, node shapes, edge styles, and themes.

Main Functions

  • splot: Plot a network with base R graphics

  • soplot: Plot a network with grid graphics

  • cograph: Create a network object for the builder functions

  • sn_layout: Apply layout algorithms

  • sn_nodes: Customize node aesthetics

  • sn_edges: Customize edge aesthetics

  • sn_theme: Apply visual themes

  • sn_render: Render to device

  • sn_ggplot: Convert to ggplot2 object

Layouts

cograph provides several built-in layouts:

  • circle: Nodes arranged in a circle

  • spring: Fruchterman-Reingold force-directed layout

  • groups: Group-based circular layout

  • custom: User-provided coordinates

Themes

Built-in themes include:

  • classic: Traditional network visualization style

  • colorblind: Accessible color scheme

  • gray: Grayscale theme

  • dark: Dark background theme

  • minimal: Clean, minimal style

  • viridis: Viridis-based color theme

  • nature: Nature-inspired color theme

Weight conventions

In the analytic functions an edge weight is a strength. A higher weight means a stronger connection, such as a larger transition probability or a stronger correlation. This follows the convention of qgraph and tna.

Path-based measures such as betweenness, closeness, harmonic centrality and eccentricity can convert weights to distances as 1 / weight^alpha. The invert_weights argument of centrality controls this conversion. Its default is TRUE for tna objects and FALSE for other inputs, which matches igraph and sna. The alpha argument (default 1) sets the exponent.

Measures that do not use paths, such as degree, strength, eigenvector centrality, PageRank and transitivity, use the weights as given. Functions with a weights argument, such as shortest_paths, compute unweighted results when weights = NA. Individual help pages document exceptions.

Author

Maintainer: Sonsoles López-Pernas sonsoles.lopez@uef.fi [copyright holder]

Authors:

  • Mohammed Saqr [copyright holder]