From byron.ellis at gmail.com  Tue Feb  6 22:32:29 2007
From: byron.ellis at gmail.com (Byron Ellis)
Date: Tue, 6 Feb 2007 13:32:29 -0800
Subject: [Rd] Transparency convenience function
Message-ID: <7098abec0702061332y3de9756md407f550757a87fd@mail.gmail.com>

Hi all,

For making plots with transparency I've found the following function
quite useful when specifying colors that I thought might be of
interest (I suspect it's easier to implement under R-devel. IIRC rgb()
now takes matrix arguments):

alpha <- function(colors,alpha=1.0) {
	if(alpha < 0 || alpha > 1)
		stop("alpha must be in [0,1]")
	apply(col2rgb(colors)/255,2,function(x) rgb(x[1],x[2],x[3],alpha))
}

-- 
Byron Ellis (byron.ellis at gmail.com)
"Oook" -- The Librarian



[Rd] Transparency convenience function
Byron Ellis