[adegenet-commits] r535 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Jan 15 15:14:30 CET 2010
Author: jombart
Date: 2010-01-15 15:14:30 +0100 (Fri, 15 Jan 2010)
New Revision: 535
Modified:
pkg/R/colorplot.R
Log:
added transparency to colorplot
Modified: pkg/R/colorplot.R
===================================================================
--- pkg/R/colorplot.R 2010-01-15 11:58:31 UTC (rev 534)
+++ pkg/R/colorplot.R 2010-01-15 14:14:30 UTC (rev 535)
@@ -19,7 +19,7 @@
#################
# default method
#################
-colorplot.default <- function(xy, X, axes=1:ncol(X), add.plot=FALSE, defaultLevel=0, ...){
+colorplot.default <- function(xy, X, axes=1:ncol(X), add.plot=FALSE, defaultLevel=0, transp=FALSE, alpha=.5, ...){
## some checks
if(any(is.na(xy))) stop("NAs exist in xy")
@@ -47,7 +47,11 @@
if(ncol(X)>=3) {v3 <- X[,3]} else {v3 <- defaultLevel}
## make colors
- col <- rgb(v1, v2, v3, maxColorValue=max(X))
+ if(transp){
+ col <- rgb(v1/max(X), v2/max(X), v3/max(X), alpha)
+ } else {
+ col <- rgb(v1, v2, v3, maxColorValue=max(X))
+ }
## handle ...
listArgs <- list(...)
@@ -56,7 +60,7 @@
## build list of arguments
listArgs$x <- xy
listArgs$col <- col
-
+
## plot data
if(!add.plot) {
do.call(plot,listArgs)
More information about the adegenet-commits
mailing list