plot-methods | R Documentation |
plot
in the package haplotypesPlots statistical parsimony networks.
## S4 method for signature 'Parsimnet'
plot(x,y,net=1,inter.labels=FALSE,...)
x |
an object of class |
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 |
These methods call plot.network.default
from package network. Some default parameters are changed:
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.
boolean; should arrows (rather than line segments) be used to indicate edges? Default is set to FALSE.
the vertex placement algorithm. Default is set to "kamadakawai"
.
amount to pad the plotting range; useful if labels are being clipped. Default is set to 1.
character expansion factor for label text. Default is set to 0.75.
a numeric vector of expansion factor for vertices. By default it is 0.8 for haplotypes and 0.5 for intermediates.
an integer or character vector for the vertex colors. By default it is 2 (red) for haplotypes and 4 (blue) for intermediates.
A two-column matrix containing the vertex positions as x,y coordinates.
signature(x = "Parsimnet",y = "missing")
Plots Parsimnet objects.
Caner Aktas, caktas.aca@gmail.com.
parsimnet
, plot.default
and plot.network.default
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.