Change edge color, font color and tick color on Haplotype Network Plot in R
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 following changes:
I would like an image such as the one below:
I have not been able to figure out the parameters required for the plot command or the correct combination of functions to achieve this.
I'm hoping that someone here can help. Thanks.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Problem is partially solved. I can change some of the edge colors using the col.links options in the plot function. i.e. plot(net, col.link = "red", ...)
– Nishan
Jul 1 at 18:43