Some Data
Here are two arrays, each of which have about 1/3 of their cells completely white (i.e. zero).
t1 = {{0, 0.9879420302163389`, 0, 0, 0.1849135890743674`}, {0.5742726088623453`, 0, 0.7914989802131724`, 0.19955892383000506`, 0.5597205682260553`}, {0.2783414505391293`, 0, 0.9748372906416929`, 0.08279443406565345`, 0.2832336389395025`}, {0.08577104927374801`, 0.7063421364586411`, 0, 0.5527067781783652`, 0.6623671920909151`}, {0.894385628016626`, 0.9220701552898367`, 0, 0, 0}}
t2 = {{0, 0.12518558916583622`, 0.7837612564671677`, 0, 0.3613465765727111`}, {0, 0.5040126862416661`, 0.7678471080216887`,0.8343516601886358`, 0.8591413788042153`}, {0.02105789348188214`, 0, 0.28409400830761267`, 0, 0}, {0.6511904278640404`, 0.5489190727738871`, 0.1852029426833548`, 0, 0.2908999228718716`}, {0.9793706128289879`, 0.5649780777815978`, 0.3898922119375319`, 0.24108312672016763`, 0.03651079793179979`}}
t3
is the sum of t1
, t2
, with the constraint that non-zero values are rapped in r
or g
, to later be interpreted as red and green.
t3 = (t1 /. {x_?NumberQ /; x != 0 :> r[x]}) + (t2 /. {x_?NumberQ /; x != 0 :> g[x]})
/. {g[x_] + r[y_] :> (x + y)/2, g[x_] :> Blend[{White, Green}, x], r[x_]
:> Blend[{White, Red}, x]};
When red intersects with green, they make yellow (with an intensity that corresponds to the average of their hues); when red intersects with white, red prevails; when green intersects with white, green prevails. (I used Chop
to ensure that a portion of the cells would remain white. )
t1
and t2
are plotted as red and green Arrays.
t3
is plotted in red, green, white, and yellow (where red and green intersect).
a1 = ArrayPlot[t1, ColorFunction -> (Blend[{White, Red},#] &), ImageSize -> 150, PlotLabel -> "a1"];
a2 = ArrayPlot[t2, ColorFunction -> (Blend[{White, Green}, #] &), ImageSize -> 150, PlotLabel -> "a2"];
a3 = ArrayPlot[t3, ImageSize -> 150, ColorFunction -> (Blend[{White, Yellow}, #] &), PlotLabel -> "a3"];
GraphicsGrid[{{a1, a2, a3}}]
