Learn R Programming

cograph (version 1.5.2)

sn_save: Save Network Visualization

Description

Save a Cograph network visualization to a file.

Usage

sn_save(network, filename, width = 7, height = 7, dpi = 300, title = NULL, ...)

Value

Invisible filename.

Arguments

network

A cograph_network object, matrix, data.frame, or igraph object. Matrices and other inputs are auto-converted.

filename

Output filename. Format is detected from extension.

width

Width in inches (default 7).

height

Height in inches (default 7).

dpi

Resolution for raster formats (default 300).

title

Optional plot title.

...

Additional arguments passed to the graphics device.

Examples

Run this code
# \donttest{
adj <- matrix(c(0, 1, 1, 1, 0, 1, 1, 1, 0), nrow = 3)
# With cograph()
net <- cograph(adj)
sn_save(net, file.path(tempdir(), "network.pdf"))

# Direct matrix input
sn_save(adj, file.path(tempdir(), "network.png"), dpi = 300)
# }

Run the code above in your browser using DataLab