[R-gregmisc-users] SF.net SVN: r-gregmisc:[1472] trunk/gplots
Brought to you by:
warnes
|
From: <wa...@us...> - 2011-08-16 01:16:06
|
Revision: 1472
http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1472&view=rev
Author: warnes
Date: 2011-08-16 01:16:00 +0000 (Tue, 16 Aug 2011)
Log Message:
-----------
Add 'alpha' argument to rich.colors() to control transparency.
Modified Paths:
--------------
trunk/gplots/R/rich.colors.R
trunk/gplots/man/rich.colors.Rd
Modified: trunk/gplots/R/rich.colors.R
===================================================================
--- trunk/gplots/R/rich.colors.R 2011-08-16 01:03:31 UTC (rev 1471)
+++ trunk/gplots/R/rich.colors.R 2011-08-16 01:16:00 UTC (rev 1472)
@@ -1,4 +1,8 @@
-rich.colors <- function(n, palette="temperature", alpha=1, plot=FALSE)
+rich.colors <- function(n,
+ palette="temperature",
+ alpha=1,
+ rgb=FALSE,
+ plot=FALSE)
{
if(n <= 0)
return(character(0))
@@ -20,9 +24,13 @@
b[x>0.4] <- 1
}
- rgb.m <- matrix(c(r,g,b), ncol=3, dimnames=list(NULL,c("red","green","blue")))
+ rgb.m <- matrix(c(r,g,b), ncol=3,
+ dimnames=list(NULL,c("red","green","blue")))
col <- mapply(rgb, r, g, b, alpha)
+ if(rgb)
+ attr(col, "rgb") <- cbind(rgb.m, alpha)
+
if(plot)
{
opar <- par("fig", "plt")
Modified: trunk/gplots/man/rich.colors.Rd
===================================================================
--- trunk/gplots/man/rich.colors.Rd 2011-08-16 01:03:31 UTC (rev 1471)
+++ trunk/gplots/man/rich.colors.Rd 2011-08-16 01:16:00 UTC (rev 1472)
@@ -6,14 +6,17 @@
and in an order that is easy to interpret.
}
\usage{
-rich.colors(n, palette="temperature", rgb=FALSE, plot=FALSE)
+rich.colors(n, palette="temperature", alpha=1.0, rgb=FALSE, plot=FALSE)
}
\arguments{
\item{n}{number of colors to generate.}
\item{palette}{palette to use: \code{"temperature"} contains
blue-green-yellow-red, and \code{"blues"} contains
black-blue-white.}
- \item{alpha}{alpha transparency, from 0 to 1.}
+ \item{alpha}{alpha transparency, from 0 (fully transparent) to 1
+ (opaque).}
+ \item{rgb}{if ‘TRUE’ then a matrix of RGBA values is included as an
+ attribute.}
\item{plot}{whether to plot a descriptive color diagram.}
}
\value{A character vector of color codes.}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|