[adegenet-commits] r584 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Feb 19 13:12:55 CET 2010


Author: jombart
Date: 2010-02-19 13:12:55 +0100 (Fri, 19 Feb 2010)
New Revision: 584

Modified:
   pkg/R/haploPop.R
Log:
added transparency capabilities


Modified: pkg/R/haploPop.R
===================================================================
--- pkg/R/haploPop.R	2010-02-19 12:05:20 UTC (rev 583)
+++ pkg/R/haploPop.R	2010-02-19 12:12:55 UTC (rev 584)
@@ -501,7 +501,16 @@
 
     ## SHOW POPULATIONS ##
     if(!is.null(col)){
-         points(xy$xx[2:(N+1)], xy$yy[2:(N+1)], pch=20, col=col, cex=tip.cex)
+          if(transp){
+            transp <- function(col, alpha=.5){
+                res <- apply(col2rgb(col),2, function(c) rgb(c[1]/255, c[2]/255, c[3]/255, alpha))
+                return(res)
+            }
+
+            pop <- transp(pop)
+        }
+          points(xy$xx[2:(N+1)], xy$yy[2:(N+1)], pch=20, col=col, cex=tip.cex)
+
     } else if(show.pop){
         nPop <- length(x$pop)
         popSizes <- sapply(x$pop, length)



More information about the adegenet-commits mailing list