Context
Let me define two colour tables: (which come from brewer and xmedcom respectively)
GoldColor = Blend[{{0, Black},
{1/9, RGBColor[32/97, 1/62, 0]},
{2/5, RGBColor[44/59, 23/78, 1/32]},
{3/5, RGBColor[84/85, 1/2, 4/51]},
{2/3, RGBColor[84/85, 53/87, 1/10]},
{4/5, RGBColor[84/85, 4/5, 11/32]},
{9/10, RGBColor[84/85, 68/75, 46/75]},
{1, White}}, #1] &
and
GalColor = Blend[{
{0, RGBColor[7/11, 0, 1/7]},
{1/17, RGBColor[10/13, 1/9, 1/7]},
{31/255, RGBColor[7/8, 1/4, 1/6]},
{47/255, RGBColor[13/14, 5/13, 1/4]},
{21/85,RGBColor[31/32, 5/9, 4/13]},
{79/255,RGBColor[46/47, 7/10, 2/5]},
{19/51, RGBColor[46/47, 5/6, 9/17]},
{37/85, RGBColor[1, 10/11, 5/8]},
{127/255, RGBColor[1, 1, 3/4]},
{143/255, RGBColor[10/11, 22/23, 7/8]},
{53/85, RGBColor[5/6, 11/12, 17/18]},
{35/51, RGBColor[7/10, 6/7, 10/11]},
{191/255, RGBColor[4/7, 10/13, 6/7]},
{69/85, RGBColor[3/7, 21/32, 4/5]},
{223/255, RGBColor[1/3, 8/15, 11/15]},
{239/255,RGBColor[1/4, 5/13, 2/3]},
{1, RGBColor[1/5, 3/13, 3/5]}}, #1] &
which looks like this:
GraphicsRow[{ContourPlot[x y , {x, -1, 1}, {y, -1, 1},
ColorFunction -> GalColor],
ContourPlot[x y , {x, -1, 1}, {y, -1, 1},
ColorFunction -> GoldColor]}]
But if I use it on large data sets, the first one works fine
dat = RandomReal[{0, 1}, {512, 512}];
Graphics[Raster[dat, ColorFunction -> GoldColor]]
whereas the second one fails with Raster
Graphics[Raster[dat, ColorFunction -> GalColor]]
(* void plot *)
while it works fine with MatrixPlot
Note that the problem depends on the size of dat
; e.g. it works fine with 256^2
.
Question
How come Raster
fails on this color table?
Raster
. A workaround is to inject the evaluated colour data intoFunction
usingWith
:GalColor = With[{x = big list}, Blend[x, #]&]
$\endgroup$