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.

Is this a bug with ColorFunctionScaling?

When I try to supply my own ColorFunction Mathematica seems to partially ignore it, and the white color "burns through" if the function is too "sharp":

mycf[z_] := RGBColor[z, 0, 0]

GraphicsRow[
  {DensityPlot[(Sin[x] Sin[y])^4, {x, 0, Pi}, {y, 0, Pi},
    ColorFunction -> mycf, ColorFunctionScaling -> False],
   DensityPlot[(Sin[x] Sin[y])^5, {x, 0, Pi}, {y, 0, Pi}, 
    ColorFunction -> mycf, ColorFunctionScaling -> False]}
]

density plots

share|improve this question
1  
Try PlotRange -> All. –  J. M. Nov 8 '12 at 1:09
    
Oh, right, that fixes it. Thanks! (Make that an answer, so I can accept it.) –  Sampo Smolander Nov 8 '12 at 1:11
add comment

1 Answer

up vote 4 down vote accepted

DensityPlot[] was automatically cutting off your function at the peak. To fix this, add the option PlotRange -> All:

DensityPlot[(Sin[x] Sin[y])^5, {x, 0, Pi}, {y, 0, Pi}, 
            ColorFunction -> mycf, ColorFunctionScaling -> False, PlotRange -> All]

correct density plot

share|improve this answer
    
Why community wiki? –  Rahul Narain Nov 8 '12 at 1:16
2  
@RahulNarain Because he can :) –  belisarius Nov 8 '12 at 1:33
add comment

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.