snha_layout {snha}R Documentation

Determine graph layouts

Description

This function returns xy coordinates for a given input adjacency matrix or snha graph. It is useful if you like to plot the same set of nodes with different edge connections in the same layout.

Usage

snha_layout( 
   A, 
   mode='sam', 
   method='pearson',  
   noise=FALSE,  
   star.center=NULL, 
   interactive=FALSE) 

Arguments

A

an adjacency matrix or an snha graph object

mode

character string for the layout type, can be either 'mds' (mds on graph using shortest paths), 'mdsd' (mds on data) 'sam' (sammon on graph), 'samd' (sammon on data), 'circle', 'grid' or 'star', default: 'sam'

method

method for calculating correlation distance if mode is either 'mdsd' or 'samd', default: 'pearson'

noise

should some noise be added, default: FALSE

star.center

the centered node if layout is 'star', must be a character string for the node name, default: NULL

interactive

switch into interactive mode where you can click in the graph and move nodes with two clicks, first selecting the node, second click gives the new coordinates for the node, default: FALSE

Value

matrix with x and y columns for the layout

Examples

 
data(swiss) 
sw.s=snha(swiss,method='spearman') 
sw.p=snha(swiss,method='pearson') 
lay=snha_layout(sw.s,mode='sam') 
plot(sw.s,layout=lay) 
plot(sw.p,layout=lay) 
plot(sw.s,layout='star',star.center='Education') 
rn1=rnorm(nrow(swiss)) 
nswiss=cbind(swiss,Rn1=rn1) 
plot(snha(nswiss,method='spearman'),layout='sam') 
plot(snha(nswiss,method='spearman'),layout='samd', 
  vertex.size=2,vertex.color='beige') 

[Package snha version 0.1.3 Index]