YinLiLin / CMplot

📊 Circular and Rectangular Manhattan Plot
499 stars 111 forks source link

highlighted SNPs in different color #79

Open beifanglingyang opened 1 year ago

beifanglingyang commented 1 year ago

Hi, thanks for the great package. I'm trying to make a multi-trait manhattan plot.When I didn't add color to the highlighted points' text, I successfully get the picture.Since I want to highlight the gene's name using different colors , that's not perfect. code: CMplot(tsh, plot.type="m", LOG10=TRUE, ylim=NULL, threshold=c(1e-6,5e-8),multracks=TRUE, col = rep(c("cyan", "sandybrown"), 13), cex=0.5, threshold.lty=c(1,2),threshold.lwd=c(2,2), threshold.col=c("red","black"), amplify=F, bin.size=1e2,chr.den.col=c("darkgreen", "yellow","red"), signal.col=c("red","green"),signal.cex=c(1,1), signal.pch=c(19,19), highlight=listsnp, highlight.text=listgene, highlight.col = listcolor, highlight.text.cex=2, highlight.cex = 1, file="jpg",memo="_CMplot_0907",dpi=1200, file.output=TRUE,verbose=TRUE, width=15,height=9) image

So I added a parameter to control the color of the text. This parameter (highlight.text.col=listcolor)is exactly the same as the color of the Highlighted points. Unfortunately, it reports an error.

CMplot(tsh, plot.type="m", LOG10=TRUE, ylim=NULL, threshold=c(1e-6,5e-8),multracks=TRUE, col = rep(c("cyan", "sandybrown"), 13), cex=0.5, threshold.lty=c(1,2),threshold.lwd=c(2,2), threshold.col=c("red","black"), amplify=F, bin.size=1e2,chr.den.col=c("darkgreen", "yellow","red"), signal.col=c("red","green"),signal.cex=c(1,1), signal.pch=c(19,19), highlight=listsnp, highlight.text=listgene, highlight.col = listcolor, highlight.text.col=listcolor, highlight.text.cex=2, highlight.cex = 1, file="jpg",memo="TSH_FT4_CMplot_0907",dpi=1200, file.output=TRUE,verbose=TRUE, width=15,height=9)

The bug:
Error in text.default(lay[indd, 1] + 0.5 * lay[indd, 3], lay[indd, 2] + : invalid color specification Calls: CMplot -> highlight_text -> text -> text.default In addition: There were 20 warnings (use warnings() to see them) Execution halted

My listcolor : `> listcolor [[1]] [1] "black" "black" "black" "black" "black" "black" "black" "black" "black" [10] "black" "black" "black" "black" "black" "black" "black" "black" "black" [19] "black" "black"

[[2]] [1] "black" "red" "red" "black" "black" "black" "red" "red" "red" `

I really can't figure out where the problem is, and i would truly appreciate your help to solve the problem behind them.

Thanks very much! Wei

YinLiLin commented 1 year ago

Hi Wei,

Could you mind seeding me your data and running script by email please? I need it to locate where the problem is. Thanks.

Lilin