[adegenet-commits] r485 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 17 17:10:24 CET 2009


Author: jombart
Date: 2009-11-17 17:10:24 +0100 (Tue, 17 Nov 2009)
New Revision: 485

Modified:
   pkg/R/haploPop.R
Log:
fix plot when only one pop


Modified: pkg/R/haploPop.R
===================================================================
--- pkg/R/haploPop.R	2009-11-17 15:24:26 UTC (rev 484)
+++ pkg/R/haploPop.R	2009-11-17 16:10:24 UTC (rev 485)
@@ -443,7 +443,12 @@
         pop.id <- rep(1:length(x$pop), popSizes)
         opal <- palette()
         on.exit(palette(opal))
-        pop.col <- rainbow(nPop)
+        if(nPop>1){
+            pop.col <- rainbow(nPop)
+        } else {
+            pop.col <- c("red","red")
+        }
+
         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))



More information about the adegenet-commits mailing list