plot.gRapHD: Plots a gRapHD object

Description Usage Arguments Details Value Author(s) References Examples

View source: R/functions.r

Description

Methods for class gRapHD.

Usage

1
2
3
4
5
6
7
## S3 method for class 'gRapHD'
plot(x,vert=NULL,numIter=50,main="",plotVert=TRUE,plotEdges=TRUE,
     energy=FALSE,useWeights=FALSE,vert.hl=NULL,col.hl="red",
     vert.radii=0.01,coord=NULL,col.ed="darkgray",lty.ed=1,lwd.ed=1,
     lwd.vert=1,border=0,symbol.vert=1,cex.vert.label=.40, 
     vert.labels=TRUE,asp=NA,disp=TRUE,font=par("font"),
     col.labels=NULL,add=FALSE,...)

Arguments

x

a gRapHD object.

vert

vector of vertices to be plotted. If NULL, all vertices will be plotted

numIter

number of iterations for the Fruchterman-Reingold algorithm.

main

main title.

plotVert

if TRUE the vertices are plotted.

plotEdges

if TRUE the edges are plotted.

energy

if TRUE use the minimum energy as initial values.

useWeights

if TRUE use the model$statSeq as edge length weights).

vert.hl

vector of vertices to be highlighted.

col.hl

colour to be used in the highlighted vertices.

vert.radii

radii of the vertices (scalar or vector with length equal to the number of vertices). See 'Details'.

coord

initial coordinate values for the vertices.

col.ed

colour of the edges (scalar or vector).

lty.ed

type of line for the edges (scalar or vector).

lwd.ed

width of the line for the edges (scalar or vector).

lwd.vert

width of the vertices' border (scalar or vector).

border

colour of the vertices borders (scalar or vector).

symbol.vert

symbol to be used in the vertices (length 1 or number of vertices): 0 is a ellipse (a=2*vs,b=vs), 1 a circle, 2 a square, 3 or higher represents the number of sides (scalar or vector).

cex.vert.label

numeric character expansion factor for the labels; multiplied by par yields the final character size. NULL and NA are equivalent to 1.0 (scalar or vector).

vert.labels

labels to be used in the vertices. If FALSE, the vertices are not labeled (scalar or vector).

asp

numeric, giving the aspect ratio y/x (see plot.window for more details).

disp

if TRUE (default), the graph is plotted.

font

an integer which specifies which font to use for the labels. If possible, device drivers let 1 correspond to plain text (the default), 2 to bold face, 3 to italic and 4 to bold italic.

col.labels

colour of the labels. Default is NULL, using black for continuous vertices and white for discrete (scalar or vector).

add

if add is TRUE, the graph is added to an existing plot (the ACTIVE one), otherwise a new plot is created.

...

further arguments passed to or from other methods.

Details

Plot a graph based on the list of edges.
Only one (model or edges) should be provided. If model, the function uses also the information about the type of variables (discrete or continuous). If edges, then all variables are plotted as continuous (circles).
The plotting area is square, ranging from 0 to 1. The unit of parameter vs follow the axes.
The algorithm proposed by Fruchterman & Reingold (1991) is used to determine the position of each vertex. It is not initialised randomly, but in a regular grid.
The graph is always positioned in a square centred in (0.5,0.5) with sides of length one.

Value

The coordinates for the vertices are returned, as a matrix. This may be used in subsequent calls to plot using the coord argument, usually with numIter=0.

Author(s)

Gabriel Coelho Goncalves de Abreu (abreu_ga@yahoo.com.br)
Rodrigo Labouriau (Rodrigo.Labouriau@agrsci.dk)

References

Fruchterman, T.M.J. and Reingold, E.M. (1991) Graph Drawing by Force-directed Placement. Software-Practice and Experience, Vol. 21(11), 1129-1164.

Csardi G, Nepusz T: The igraph software package for complex network research, InterJournal, Complex Systems 1695. 2006. http://igraph.sf.net

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
data(dsCont)
m1 <- minForest(dsCont,homog=TRUE,forbEdges=NULL,stat="LR")
plot(m1,numIter=1000)

# or
plot(m1,numIter=1000,plotVert=FALSE,labelVert=FALSE)

#############
r <- 3
edges <- rep(1,r)
x <- 2+r-1
edges <- c(edges,sort(rep(2:x,r-1)))
edges <- c(edges,sort(rep((x+1):(x+(x-1)*(r-1)),r-2)))
edges <- c(edges,sort(rep((x+(x-1)*(r-1)+1):(x+(x-1)*(r-1)+
                          (x-1)*(r-1)*(r-2)),r-3)))
edges <- cbind(edges,2:(length(edges)+1))
a <- neighbourhood(edges=edges,orig=1,rad=r)
vs <- a$v[,2]
vs <- 1/vs
vs[1] <- 2
vs <- vs/30
model <- new("gRapHD",edges=edges)
plot(model,numIter=200,col.hl=colours()[386:383][a$v[,2]+1],
     vert.hl=a$v[,1],vert.radii=vs,border="black",lwd.vert=2)

gRapHD documentation built on Feb. 9, 2018, 6:05 a.m.

Related to plot.gRapHD in gRapHD...