baptiste auguie <baptiste.auguie <at> googlemail.com> writes: > Adding two semi-transparent colours results in non-intuitive colour > mixing (a mystery for me anyway). Is it additive (light), substractive > (paint), or something else? Consider the following example, depending > on the order of the two "layers" the overlap region is either purple > or dark red. I have no idea why. > > png("testingOrder.png") > plot.new() > > # Red below > rect(0.3, 0.5, 1, 1, col=rgb(1, 0, 0, alpha=0.5)) > rect(0, 0.5, 0.7, 1, col=rgb(0, 0, 1, alpha=0.5)) > > # Blue below > rect(0, 0, 0.7, 0.5, col=rgb(0, 0, 1, alpha=0.5)) > rect(0.3, 0, 1, 0.5, col=rgb(1, 0, 0, alpha=0.5)) > > dev.off() I would expect overlaid transparencies to act like filters and multiply, producing so-called subtractive color mixing, so blue and yellow gives green. Interestingly, however, overlaying filters is not necessarily a commutative operation, since a transparent filter can yield an additive component (through scatter, for example) though I suspect that the non-commutativity comes about in R because these rules apply to physical lights, filters and surfaces and in R, it is some uncalibrated combination of frame buffer values that is being used.
> Best, > > baptiste > Ken -- Ken Knoblauch Inserm U846 Stem-cell and Brain Research Institute Department of Integrative Neurosciences 18 avenue du Doyen Lépine 69500 Bron France tel: +33 (0)4 72 91 34 77 fax: +33 (0)4 72 91 34 61 portable: +33 (0)6 84 10 64 10 http://www.sbri.fr/members/kenneth-knoblauch.html ______________________________________________ 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.