plot-methods: Methods for function 'plot' in the package 'haplotypes'

plot-methodsR Documentation

Methods for function plot in the package haplotypes

Description

Plots statistical parsimony networks.

Usage

## S4 method for signature 'Parsimnet'
plot(x,y,net=1,inter.labels=FALSE,...)
 

Arguments

x

an object of class Parsimnet.

y

not used (needed for compatibility with generic plot function).

net

a numeric vector of length one indicating which network to plot.

inter.labels

boolean; should vertex labels of intermediate haplotypes to be displayed?

...

additional arguments to plot.default, plot.network.default and arguments to be passed to plot method for Parsimnet objects. See ‘Details’

Details

These methods call plot.network.default from package network. Some default parameters are changed:

label

a vector of vertex labels. By default the row names of the distance matrices in slot d are used. If inter.labels==FALSE only haplotype labels are displayed.

usearrows

boolean; should arrows (rather than line segments) be used to indicate edges? Default is set to FALSE.

mode

the vertex placement algorithm. Default is set to "kamadakawai".

pad

amount to pad the plotting range; useful if labels are being clipped. Default is set to 1.

label.cex

character expansion factor for label text. Default is set to 0.75.

vertex.cex

a numeric vector of expansion factor for vertices. By default it is 0.8 for haplotypes and 0.5 for intermediates.

vertex.col

an integer or character vector for the vertex colors. By default it is 2 (red) for haplotypes and 4 (blue) for intermediates.

Value

A two-column matrix containing the vertex positions as x,y coordinates.

Methods

signature(x = "Parsimnet",y = "missing")

Plots Parsimnet objects.

Author(s)

Caner Aktas, caktas.aca@gmail.com.

See Also

parsimnet, plot.default and plot.network.default

Examples

	
	
## Not run: 
	
data("dna.obj")
x<-dna.obj


### Method for signature 'Parsimnet'.

## Statistical parsimony with 95
p<-parsimnet(x) 
p
## Plotting with default parameters.
plot(p)

## Displaying vertex labels of intermediate haplotypes.
plot(p, inter.labels=TRUE)

## Interactively adjusting vertex positions.
plot(p, interactive=TRUE)

## Interactively adjusting and saving vertex positions.
p<-parsimnet(x)
#saving vertex positions as x,y coordinates. 
coo<-plot(p,interactive=TRUE) 
#reuse saved coordinates.
plot(p,coord=coo)

## Adjusting vertex sizes.
plot(p, vertex.cex=c(rep(3,nrow(p@d[[1]]))))
# different sizes for haplotypes and intermediates
plot(p, vertex.cex=c(rep(3,p@nhap),rep(1,c(nrow(p@d[[1]])-p@nhap)))) 

## Adjusting vertex colors
# different color for haplotypes and intermediates
plot(p, vertex.col=c(rep("magenta",p@nhap),rep("deepskyblue3",c(nrow(p@d[[1]])-p@nhap))))  
 
## Statistical parsimony with 98
p<-parsimnet(x,prob=.99) 
p
#plot the first network
plot(p,net=1)
#plot the second network
plot(p,net=2)
#plot the third network. It is a single vertex.
plot(p,net=3) 






## End(Not run)


haplotypes documentation built on July 26, 2023, 5:22 p.m.