| Type: | Package |
| Version: | 1.0.9 |
| 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, lifecycle |
| 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-07-23 18:16:03 UTC; maac |
| Author: | Victor Apolonio [ctb],
Vinicius Chagas [ctb],
Mauro Castro |
| Maintainer: | Mauro Castro <mauro.a.castro@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2025-07-23 19:10:25 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:
Victor Apolonio [contributor]
Vinicius Chagas [contributor]
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:
Report bugs at https://github.com/sysbiolab/RGraphSpace/issues
Constructor of GraphSpace-class objects
Description
GraphSpace is a constructor of
GraphSpace-class objects.
Usage
GraphSpace(g, mar = 0.1, layout = NULL, image = NULL, verbose = TRUE)
Arguments
g |
An |
mar |
A single numeric value (in |
layout |
An optional numeric matrix with two columns for |
image |
An optional background image. When provided, |
verbose |
A single logical value specifying to display detailed
messages (when |
Value
A GraphSpace class object.
Author(s)
Sysbiolab.
See Also
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
nodesA data frame with xy-vertex coordinates.
edgesA data frame with edges.
graphAn igraph object.
imageA raster background image matrix.
parsA list with parameters.
miscA 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 = "graph")
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 = 'graph')
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)
Accessors for applying essential igraph methods to modify attributes of GraphSpace objects.
Description
Access and modify individual slots of a GraphSpace object. Selected 'igraph' methods are applied to the 'graph' slot and propagated to downstream components.
Usage
## S4 method for signature 'GraphSpace'
names(x)
## S4 replacement method for signature 'GraphSpace'
names(x) <- value
## S4 method for signature 'GraphSpace'
gs_vcount(x)
## S4 method for signature 'GraphSpace'
gs_ecount(x)
## S4 method for signature 'GraphSpace'
gs_vertex_attr(x, name, ...)
## S4 replacement method for signature 'GraphSpace'
gs_vertex_attr(x, name, ...) <- value
## S4 method for signature 'GraphSpace'
gs_edge_attr(x, name, ...)
## S4 replacement method for signature 'GraphSpace'
gs_edge_attr(x, name, ...) <- value
Arguments
x |
A GraphSpace class object |
value |
The new value of the attribute. |
name |
Name of the attribute. |
... |
Additional arguments passed to igraph methods. |
Value
Updated GraphSpace object.
See Also
Examples
# Load a demo igraph
data('gtoy1', package = 'RGraphSpace')
# Create a new GraphSpace object
gs <- GraphSpace(gtoy1)
# Usage of GraphSpace attribute accessors:
# Get vertex names
names(gs)
# Get vertex count
gs_vcount(gs)
# Get edge count
gs_ecount(gs)
# Access all vertex attributes
gs_vertex_attr(gs)
# Access a specific vertex attribute
gs_vertex_attr(gs, "nodeLabel")
# Modify a single value within a vertex attribute
gs_vertex_attr(gs, "nodeSize")["n1"] <- 10
# Replace an entire vertex attribute
gs_vertex_attr(gs, "nodeSize") <- 10
# Alternative syntax using `$` accessor
gs_vertex_attr(gs)$nodeSize <- 10
# Access a specific edge attribute
gs_edge_attr(gs, "edgeLineColor")
# Replace an entire edge attribute
gs_edge_attr(gs, "edgeLineWidth") <- 1
# Alternative syntax using `$` for edge attributes
gs_edge_attr(gs)$edgeLineWidth <- 3
Plot GraphSpace objects
Description
Plot GraphSpace objects
Usage
## S3 method for class 'GraphSpace'
plot(x, ...)
Arguments
x |
A GraphSpace class object. |
... |
Additional arguments passed to the
|
See Also
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,
theme = c("th0", "th1", "th2", "th3"),
xlab = "Graph coordinates 1",
ylab = "Graph coordinates 2",
font.size = 1,
bg.color = "grey95",
add.labels = FALSE,
node.labels = NULL,
label.size = 3,
label.color = "grey20",
add.image = FALSE,
marks = deprecated(),
mark.size = deprecated(),
mark.color = deprecated()
)
## S4 method for signature 'igraph'
plotGraphSpace(gs, ..., mar = 0.1)
Arguments
gs |
Either an |
theme |
Name of a custom RGraphSpace theme. These themes
(from 'th1' to 'th3') consist of preconfigured ggplot settings,
which the user can subsequently refine using |
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. |
bg.color |
A single color for background. |
add.labels |
A logical value indicating whether to plot vertex labels. |
node.labels |
A vector of vertex names to be highlighted in the graph space. This argument overrides 'add.labels'. |
label.size |
A size argument passed to |
label.color |
A color passed to |
add.image |
A logical value indicating whether to add a background
image, when one is available (see |
marks |
Deprecated from RGraphSpace 1.0.9; use 'node.labels' instead. |
mark.size |
Deprecated from RGraphSpace 1.0.9; use 'label.size' instead. |
mark.color |
Deprecated from RGraphSpace 1.0.9; use 'label.color' instead. |
... |
Additional arguments passed to the
|
mar |
A single numeric value (in |
Value
A ggplot-class object.
Author(s)
Sysbiolab.
See Also
Examples
# Load a demo igraph
data('gtoy1', package = 'RGraphSpace')
# Generate a ggplot for igraph
plotGraphSpace(gtoy1)
# Create a GraphSpace object
gs <- GraphSpace(gtoy1)
# Generate a ggplot for gs
plotGraphSpace(gs)