geom_nodeset: Plotting of a population graph edge set using ggplot neumonic

Description Usage Arguments Value Author(s) Examples

Description

This function allows you to layer the edgeset of a popgraph object

Usage

1
geom_nodeset(mapping = NULL, graph = NULL, ...)

Arguments

mapping

The aesthetic mapping as an aes() object. This aesthetic must at least have values for x and y but you can also specify color, fill, alpha, label, and size. Color, alpha, and fill may be a single value for all nodes or vertex attributes for each node.

graph

The popgraph/igraph object to be plot

...

Largely ignored.

Value

A formatted geom_segment object for addition to a ggplot()

Author(s)

Rodney J. Dyer <rjdyer@vcu.edu>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(igraph)
a <- matrix( c(0,1,0,1,1,0,0,1,0,0,0,1,1,1,1,0),nrow=4)
rownames(a) <- colnames(a) <- LETTERS[1:4]
graph <- as.popgraph(a)
igraph::V(graph)$x <- runif(4)
igraph::V(graph)$y <- runif(4)
require(ggplot2)
ggplot() + geom_nodeset( aes(x=x,y=y), graph )
igraph::V(graph)$group <- c("A","A","B","B")
ggplot() + geom_nodeset( aes(x=x,y=y,color=group), graph, size=4 )

popgraph documentation built on April 14, 2017, 9:58 p.m.