pieplot-methods: Plots pie charts on statistical parsimony network

Description Usage Arguments Details Value Methods Note Author(s) See Also Examples

Description

Plotting pie charts on the statistical parsimony network.

Usage

1
2
## S4 method for signature 'Parsimnet,Haplotype'
pieplot(x,y,net=1,factors, coord = NULL,inter.labels=FALSE,interactive=FALSE,rex=1,...)

Arguments

x

a Parsimnet object.

y

a Haplotype object.

net

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

factors

a vector or factor giving the grouping variable (populations, species, etc.), with one element per individual.

coord

a matrix that contains user specified coordinates of the vertices, or NULL to generate vertex layouts with network.layout function from package network.

inter.labels

boolean; should vertex labels of intermediate haplotypes be displayed?

interactive

boolean; should vertices be interactively adjusted?

rex

expansion factor for the pie radius.

...

arguments to be passed to floating.pie and others. See ‘Details’

Details

This method calls floating.pie {plotrix}, network.vertex {network}, and plot.default, lines, and text {graphics}. This method also uses some internal structures of plot.network.default from package network. The following additional arguments can be passed to these functions:

mode

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

pad

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

displaylabels

boolean; should vertex labels be displayed?

label

a vector of vertex labels. By default, the rownames of the distance matrix (rownames(p@d[[net]])) are used. If inter.labels==FALSE only haplotype labels are displayed.

label.cex

character expansion factor for labels. Default is set to 0.75.

label.col

an integer or character vector for the label colors. By default, it is 1 (black).

label.pos

position at which labels should be placed relative to vertices. 0 and 6 results in labels which are placed away from the center of the plotting region; 1, 2, 3, and 4 result in labels being placed below, to the left of, above, and to the right of vertices, respectively; and label.pos 5 or greater than 6 results in labels which are plotted with no offset (i.e., at the vertex positions). Default is set to 0.

label.pad

amount to pad the labels. This setting is available only if the labels are plotted with offset relative to vertex positions. Default is set to 1.

vertex.cex

a numeric vector of expansion factor for intermediate vertices (only). By default it is (0.5)*min(radius). Use 'radius' to specify size of pie charts.

col

the colors of the pie sectors (i.e., colors for populations), by default rainbow.

vertex.col

an integer or character vector for the intermediate vertex colors. By default, it is 1 (black).

edge.col

an integer or character vector for the edge colors. By default, it is 1 (black).

edge.lwd

a numeric vector, edges line width. By default, it is 1.

edge.lty

a numeric vector of length one, specifies the line type for the edges. By default it is 1.

edges

the number of lines forming a pie circle, By default, it is 200.

radius

a numeric vector of length p@nhap[net] for the radius of drawn pie charts. Useful for specifying the radius independent of the haplotype frequencies. Default is (0.8*(haplotype frequencies)*rex)/max(haplotype frequencies).

vertex.sides

number of polygon sides for vertices. Default is set to 50.

xlab

x axis label.

xlab

y axis label.

Value

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

Methods

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

Note

Some internal structures of plot.network.default is taken from package network with modifications, author Carter T. Butts.

Author(s)

Caner Aktas, caktas.aca@gmail.com.

See Also

plot,Parsimnet-method,floating.pie, plot.default and plot.network.default

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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
data("dna.obj")
x<-dna.obj
h<-haplotypes::haplotype(x)

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

#randomly generated populations
pop<-c("pop1","pop2","pop3","pop4","pop5","pop6","pop7","pop8")
set.seed(5)
pops<-sample(pop,nrow(x),replace=TRUE)

## Plotting with default parameters.
pieplot(p,h,1, pops)

## Change colors for the populations.
#8 colors for 8 populations 
cols<-colors()[c(30,369,552,558,538,642,142,91)]
pieplot(p,h,1, pops,col=cols)

## Expanding pie charts and intermediate vertices.
pieplot(p,h,1, pops,rex=2)

## Adjusting intermediate vertex sizes.
pieplot(p,h,1, pops, vertex.cex=rep(0.2, nrow(p@d[[1]])-p@nhap))

## Expanding pie charts and intermediate vertices, adjusting intermediate vertex sizes.
pieplot(p,h,1, pops,rex=2, vertex.cex=rep(0.1, nrow(p@d[[1]])-p@nhap))

## Adjusting radius of pie charts.
pieplot(p,h,1, pops,radius=rep(1, p@nhap))

## Not run:  
## Interactively adjusting vertex positions.
pieplot(p,h,1, pops, interactive=TRUE)

## End(Not run)

### Multiple networks with 99% connection limit.
p<-parsimnet(x,prob=.99) 

## Plotting first network with default parameters.
pieplot(p,h,1, pops)

## Change colors for the populations.
#8 colors for 8 populations
cols<-colors()[c(30,369,552,558,538,642,142,91)]
pieplot(p,h,1, pops,col=cols)

haplotypes documentation built on Feb. 28, 2020, 5:08 p.m.