Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Consider the following code:

jet[u_?NumericQ] := 
  Blend[{{0, RGBColor[0, 0, 9/16]}, {1/9, Blue}, {23/63, 
      Cyan}, {13/21, Yellow}, {47/63, Orange}, {55/63, Red}, {1, 
      RGBColor[1/2, 0, 0]}}, u] /; 0 <= u <= 1;
caxis[x_, {min_, max_}] := 
  If[x < min, jet[0], If[x > max, jet[1], jet[(x - min)/(max - min)]]];

data1 = Table[
   Sinc[x*y] + RandomReal[{0., 0.2}], {x, -2 Pi, 2 Pi, 0.05}, {y, -2 Pi, 2 Pi, 0.05}];
data2 = Table[
   Sinc[x*y] + RandomReal[{0., 0.2}], {x, -2 Pi, 2 Pi, 0.02}, {y, -2 Pi, 2 Pi, 0.02}];

Row[{Graphics[Raster[data1, ColorFunction -> (caxis[#, {-0.5, 2}] &)],
    ImageSize -> 200],
  Graphics[Raster[data2, ColorFunction -> (caxis[#, {-0.5, 2}] &)], 
   ImageSize -> 200],
  Graphics[Raster[data2, ColorFunction -> "BlueGreenYellow"], 
   ImageSize -> 200]}]

It gives the output:

enter image description here

Why is the second plot blank?

If the dynamic updating is turned off, all of the three are blank.

enter image description here

Why does Mathematica behave like this? I'm using OSX 10.8.4 on a Macbook Air with 1.7 GHz Intel Core i5 and 4GB memory.

share|improve this question
    
You should certainly indicate what version and OS you're working with for this type of question. The code works fine for me in version 9.0.0 on Mac OSX 10.7.4. –  Mark McClure Jun 20 '13 at 17:21
    
I'm using OSX 10.8.4. –  xslittlegrass Jun 20 '13 at 17:29
2  
this is the issue with what was originally my wavelet scalogram exporting –  amr Jun 20 '13 at 20:11
1  
Possibly related to this question. –  Simon Woods Jun 20 '13 at 21:41
1  
Identical behavior observed here on 7.0.1, 8.0.4, and 9.0.1, on Windows 2003 x64. Middle plot is missing in all cases. –  Oleksandr R. Jun 22 '13 at 2:34

1 Answer 1

Label this a most bizarre bug -- I can reproduce the problem (v9.0.0.0) -- the fix, change all those integer fractions in Blend to decimals..

This fails:

jet[u_?NumericQ] :=  Blend[{{0, RGBColor[0, 0, 1/9]}, {1, Red}}, u] /; 0 <= u <= 1

This works

jet[u_?NumericQ] := Blend[{{0, RGBColor[0, 0, 0.11111111]}, {1, Red}}, u] /; 0 <= u <= 1

Edit: another curiosity.. this should be the same (I think..) normalising the values before passing to the color function.

Graphics[Raster[data1, Automatic, {-.05, 2}, 
         ColorFunction -> (caxis[#, {0, 1}] &)], ImageSize -> 200]

Although it works, the colors are substantially different.

share|improve this answer
    
neither works with dynamic updating off. –  george2079 Jun 20 '13 at 18:15
1  
I agree this is a bug (+1). It also disappears when I remove the RandomReal from the definition of the data. –  Jens Jun 20 '13 at 18:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.