1
$\begingroup$

I have already searched for hours for a solution but didn't find anything yet. I neither understand why my problem even occurs since the function is well defined in the white areas in the picture.

The problem occurs as follows: I wanna draw a Density plot for a function with three arguments:

DensityPlot3D[1/(1 - x*y*z), {x, 0, 1}, {y, 0, 1}, {z, 0, 1},
 ColorFunction -> "BrightBands", ColorFunctionScaling -> True, 
 PlotLegends -> Placed[BarLegend[{Automatic, {0, 2}}], Right],  
 PlotRange -> All, PlotPoints -> 100]

enter image description here enter image description here

The result is a plot which is mainly white where it actually should be colored according to the legend. Does anybody know what's the problem ?

EDIT: The problem doesn't appear when I plot the inverse function instead of the original one. But the singularities of the original one are treated correctly so there should be no problem either.

$\endgroup$
1
$\begingroup$

This is a bug, and the cause goes back to at least 10.2. The workaround is to make the color function used by Raster3D a little more permissive, e.g.

DensityPlot3D[1/(1 - x*y*z), {x, 0, 1}, {y, 0, 1}, {z, 0, 1}, 
  ColorFunction -> "BrightBands", ColorFunctionScaling -> True, 
  PlotPoints -> 5, PlotLegends -> Automatic] /. #1 >= 0.5 -> #1 >= 0.49

enter image description here

$\endgroup$
  • $\begingroup$ Thank you for your answer ! I set the PlotPoints to 100 like in my example and it did what i wanted to have. $\endgroup$ – Levigeddon Mar 3 '17 at 13:38
  • $\begingroup$ @Levigeddon You're welcome. I used PlotPoints -> 5 as it was easier to dig into. :) $\endgroup$ – rcollyer Mar 3 '17 at 13:42
  • $\begingroup$ @Levigeddon just a side note. The local "economy" on this site runs on votes and accepting answers that work best. So, please do both. $\endgroup$ – rcollyer Mar 3 '17 at 13:43

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.