Posts

Showing posts with the label bioconductor

Change edge color, font color and tick color on Haplotype Network Plot in R

Image
Change edge color, font color and tick color on Haplotype Network Plot in R Using the guide on: How to plot Pie charts in haploNet Haplotype Networks {pegas} I was able to make a haplotype plot for my data. Here is my code: library(ape) library(plyr) library(pegas) ## example.DNAbin is the DNAbin class object with the alignments d <- example.DNAbin e <- dist.dna(d) h <- pegas::haplotype(d) h <- sort(h, what = "label") (net <- pegas::haploNet(h)) ind.hap<-with( stack(setNames(attr(h, "index"), rownames(h))), table(hap=ind, pop=rownames(d)[values]) ) col.vec <- adjustcolor(rainbow(ncol(ind.hap)), alpha=0.4) par(bg="white") par(mar=c(1,1,1,1)) plot(net, size=attr(net, "freq"), scale.ratio=3.00, pie=ind.hap, bg=col.vec, fg="white") title(main = "Haplotype Network Plotn of Project AGBOU", line = -2.5, col.main= "black", cex.main=2) This is the plot I obtained: I would like to make the fol...