Learn R Programming

haplotypes (version 1.0)

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

Description

Plots statistical parsimony networks.

Usage

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

Arguments

x

an object of class Parsimnet.

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 and plot.network.default.

Value

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

Methods

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

Plots Parsimnet objects.

Details

This method calls 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.

See Also

plot.default and plot.network.default

Examples

Run this code
# NOT RUN {
data("dna.obj")
x<-dna.obj

## Statistical parsimony with %95 connection limit 
p<-parsimnet(x) 
p

## Plotting with default parameters.
plot(p)

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

# }
# NOT RUN {
## Interactively adjusting vertex positions.
plot(p, interactive=TRUE)
# }
# NOT RUN {
 
## 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))))  

## Statistical parsimony with %98 connection limit.
p<-parsimnet(x,prob=.98) 
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) 
# }

Run the code above in your browser using DataLab