Dear List,

I want to use transparency in R to represent downweighting of observations based on clusters (repeated observations in a dataset). Some clusters will have identical covariate values in a parameter space -- in the 2D x,y case, these represent a bunch of semi-tranparent dots in the same place. I'd like these overlapping dots to be completely opaque. In other cases, the clusters don't have overlapping covariates, so when these dots are scattered all around, I want them to be somewhat transparent.

But it seems clear that transparency isn't additive. For example, four dots with transparency set to .25 don't add to complete opacity:

x = c(1,1,1,1)
y = c(1,1,1,1)
w = .25
plot(x,y,pch=16,col=rgb(0,0,1,.25,maxColorValue=1),cex=3,xlim=c(.8,2))

My question is the following: what function would I transform "w" by to make it so that 4*f(w) = fully opaque?

The following would suggest f(w) = w^.5, but I'd appreciate if someone could confirm for applications outside this little example, and give me a sense of how this all works, and is intended to work.

x = c(1,1,1,1)
y = c(1,1,1,1)
f = 0
plot(x,y,pch=16,col=rgb(0,0,1,(.25),maxColorValue=1),cex=3,xlim=c(.8,2))
x=x+.1; f=f-.1
points(x,y,pch=16,col=rgb(0,0,1,(.25)^(1+f),maxColorValue=1),cex=3)
x=x+.1; f=f-.1
points(x,y,pch=16,col=rgb(0,0,1,(.25)^(1+f),maxColorValue=1),cex=3)
x=x+.1; f=f-.1
points(x,y,pch=16,col=rgb(0,0,1,(.25)^(1+f),maxColorValue=1),cex=3)
x=x+.1; f=f-.1
points(x,y,pch=16,col=rgb(0,0,1,(.25)^(1+f),maxColorValue=1),cex=3)
x=x+.1; f=f-.1
points(x,y,pch=16,col=rgb(0,0,1,(.25)^(1+f),maxColorValue=1),cex=3)
x=x+.1; f=f-.1
points(x,y,pch=16,col=rgb(0,0,1,(.25)^(1+f),maxColorValue=1),cex=3)
x=x+.1; f=f-.1
points(x,y,pch=16,col=rgb(0,0,1,(.25)^(1+f),maxColorValue=1),cex=3)
x=x+.1; f=f-.1
points(x,y,pch=16,col=rgb(0,0,1,(.25)^(1+f),maxColorValue=1),cex=3)
x=x+.1; f=f-.1
points(x,y,pch=16,col=rgb(0,0,1,(.25)^(1+f),maxColorValue=1),cex=3)
x=x+.1; f=f-.1
points(x,y,pch=16,col=rgb(0,0,1,(.25)^(1+f),maxColorValue=1),cex=3)

Thanks,
Andrew

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to