6
$\begingroup$

I use Blend to color my ListDensityPlot. In my code below, I use white for zero. I would like to use white between -0.6 to 0.6. How should I change (Blend[{{-0.6, Blue}, {0, White}, {0.6, Red}}, #] &)]

 graph = ListDensityPlot[data, 
   ColorFunction -> (Blend[{{-0.6, Blue}, {0, White}, {0.6, Red}}, #] &)]
$\endgroup$
7
$\begingroup$

Perhaps

data = Table[Cos[i] Cos[j + i], {i, 0, 2 Pi, Pi/32}, {j, 0, 2 Pi, Pi/32}]; 
ListDensityPlot[data, 
 ColorFunction -> (Blend[{{-1, Blue}, {-0.6, White}, {0.6, White}, {1, Red}}, #] &), 
 ColorFunctionScaling -> False, MeshFunctions -> {#3 &}, Mesh -> {{-.6, .6}}]

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks, it is a good alternative way, I didn't thought about to add one {-0.6, White} in my function (Blend[{{-0.6, Blue}, {0, White}, {0.6, Red}}, #] &)] $\endgroup$ – Bigprophete Jun 21 '18 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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