Package 'RGraphSpace'

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.
Authors: Victor Apolonio [ctb], Vinicius Chagas [ctb], Mauro Castro [aut, cre]
Maintainer: Mauro Castro <[email protected]>
License: Artistic-2.0
Version: 1.0.7
Built: 2024-11-13 08:01:04 UTC
Source: CRAN

Help Index


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')

Constructor of GraphSpace-class objects

Description

GraphSpace is a constructor of GraphSpace-class objects.

Usage

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

Arguments

g

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

layout

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

mar

A single numeric value (in [0,1]) indicating the size of the outer margins as a fraction of the graph 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 PathwaySpace graphics

Description

GraphSpace: An S4 class for PathwaySpace graphics

Value

An S4 class object.

Slots

nodes

A data frame with xy-vertex coordinates.

edges

A data frame with edges.

graph

An igraph object.

pars

A list with parameters.

misc

A list with intermediate objects for downstream methods.

Constructor

see GraphSpace constructor.


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 package

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, ..., layout = NULL, 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.

layout

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

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)