Type: Package
Version: 1.0.8
Title: A Lightweight Interface Between 'ggplot2' and 'igraph' Objects
Description: Interface to integrate 'igraph' and 'ggplot2' graphics within spatial maps. 'RGraphSpace' implements new geometric objects using 'ggplot2' prototypes, customized for representing large 'igraph' objects in a normalized coordinate system. By scaling shapes and graph elements, 'RGraphSpace' can provide a framework for layered visualizations.
Depends: R(≥ 4.4), methods, ggplot2
Imports: grDevices, scales, grid, igraph
Suggests: knitr, rmarkdown, testthat
Enhances: RedeR
License: Artistic-2.0
VignetteBuilder: knitr
URL: https://github.com/sysbiolab/RGraphSpace
BugReports: https://github.com/sysbiolab/RGraphSpace/issues
Collate: gspaceChecks.R gspaceValidation.R gspaceSupplements.R gspaceMisc.R gspacePlots.R gspaceClasses.R gspaceGenerics.R gspaceMethods.R
Encoding: UTF-8
RoxygenNote: 7.3.2
NeedsCompilation: no
Packaged: 2025-05-14 13:18:27 UTC; maac
Author: Victor Apolonio [ctb], Vinicius Chagas [ctb], Mauro Castro ORCID iD [aut, cre]
Maintainer: Mauro Castro <mauro.a.castro@gmail.com>
Repository: CRAN
Date/Publication: 2025-05-14 13:50:02 UTC

RGraphSpace: A lightweight package for representing large igraph objects in a normalized coordinate system

Description

RGraphSpace is an R package that integrates igraph and ggplot2 graphics within spatial maps. RGraphSpace implements new geometric objects using ggplot2 protypes, customized for representing large igraph objects in a normalized coordinate system. By scaling shapes and graph elements, RGraphSpace can provide a framework for layered visualizations.

Details

Package: RGraphSpace
Type: Software
License: GPL-3
Maintainer: Mauro Castro mauro.a.castro@gmail.com

Index

GraphSpace: Constructor of GraphSpace-class objects.
plotGraphSpace: Plotting igraph objects with RGraphSpace package.
getGraphSpace: Accessors for fetching slots from a GraphSpace object.

Further information is available in the vignettes by typing vignette('RGraphSpace'). Documented topics are also available in HTML by typing help.start() and selecting the RGraphSpace package from the menu.

Author(s)

Maintainer: Mauro Castro mauro.a.castro@gmail.com (ORCID)

Other contributors:

References

Castro MAA, Wang X, Fletcher MNC, Meyer KB, Markowetz F. RedeR: R/Bioconductor package for representing modular structures, nested networks and multiple levels of hierarchical associations. Genome Biology 13:R29, 2012.

See Also

Useful links:


Constructor of GraphSpace-class objects

Description

GraphSpace is a constructor of GraphSpace-class objects.

Usage

GraphSpace(g, mar = 0.075, layout = NULL, image = NULL, verbose = TRUE)

Arguments

g

An igraph object. It must include coordinates and names assigned to x, y, and name vertex attributes.

mar

A single numeric value (in [0,1]) indicating the size of the outer margins as a fraction of the graph space. Note: mar is ignored when an image is provided.

layout

An optional numeric matrix with two columns for x and y coordinates.

image

An optional matrix, array, or raster image object. For this option, x and y coordinates must represent pixel positions in the image space.

verbose

A single logical value specifying to display detailed messages (when verbose=TRUE) or not (when verbose=FALSE).

Value

A GraphSpace class object.

Author(s)

Sysbiolab.

See Also

plotGraphSpace

Examples

# Load a demo igraph
data('gtoy1', package = 'RGraphSpace')

gs <- GraphSpace(gtoy1)


GraphSpace: An S4 class for igraph objects

Description

GraphSpace: An S4 class for igraph objects

Value

An S4 class object.

Slots

nodes

A data frame with xy-vertex coordinates.

edges

A data frame with edges.

graph

An igraph object.

image

An image matrix or array object.

pars

A list with parameters.

misc

A list with intermediate objects for downstream methods.

Constructor

see GraphSpace constructor.


Accessors for fetching slots from a GraphSpace object

Description

getGraphSpace retrives information from individual slots available in a GraphSpace object.

Usage

## S4 method for signature 'GraphSpace'
getGraphSpace(gs, what = "summary")

Arguments

gs

A preprocessed GraphSpace class object

what

A single character value specifying which information should be retrieved from the slots. Options: 'graph','gxy','gxyz','pars','misc','status','summits', 'summit_mask', and 'summit_contour'.

Value

Content from slots in the GraphSpace object.

Examples

# Load a demo igraph
data('gtoy1', package = 'RGraphSpace')

# Create a new GraphSpace object
gs <- GraphSpace(gtoy1)

# Get the 'summary' slot in gs
getGraphSpace(gs, what = 'summary')


Toy 'igraph' objects

Description

Small 'igraph' objects used for workflow demonstrations. All graphs include 'x', 'y', and 'name' vertex attributes.

Usage

data(gtoy1)

Format

igraph

Value

A pre-processed igraph object.

Source

This package.

Examples

data(gtoy1)
data(gtoy2)

Plotting igraph objects with RGraphSpace

Description

plotGraphSpace is a wrapper function to create dedicated ggplot graphics for igraph- and GraphSpace-class objects.

Usage

## S4 method for signature 'GraphSpace'
plotGraphSpace(
  gs,
  xlab = "Graph coordinates 1",
  ylab = "Graph coordinates 2",
  font.size = 1,
  theme = c("th1", "th2", "th3"),
  bg.color = "grey95",
  marks = FALSE,
  mark.size = 3,
  mark.color = "grey20"
)

## S4 method for signature 'igraph'
plotGraphSpace(gs, ..., mar = 0.075)

Arguments

gs

Either an igraph or GraphSpace class object. If gs is an igraph, then it must include x, y, and name vertex attributes (see GraphSpace).

xlab

The title for the 'x' axis of a 2D-image space.

ylab

The title for the 'y' axis of a 2D-image space.

font.size

A single numeric value passed to ggplot themes.

theme

Name of a custom RGraphSpace theme. These themes (from 'th1' to 'th3') consist mainly of preconfigured ggplot settings, which the user can subsequently fine-tune within the resulting ggplot object.

bg.color

A single color for background.

marks

A logical value indicating whether to add 'marks' to vertex positions. Alternatively, this could be a vector listing vertex names.

mark.size

A font size argument passed to geom_text.

mark.color

A color passed to geom_text.

...

Additional arguments passed to the plotGraphSpace function.

mar

A single numeric value (in [0,1]) indicating the size of the outer margins as a fraction of the graph space.

Value

A ggplot-class object.

Author(s)

Sysbiolab.

See Also

GraphSpace

Examples

# Load a demo igraph
data('gtoy1', package = 'RGraphSpace')

# Generate a ggplot for gtoy1
plotGraphSpace(gtoy1)

# Create a GraphSpace object
gs <- GraphSpace(gtoy1)

# Generate a ggplot for gs
plotGraphSpace(gs)