4
$\begingroup$

First, define

data = Flatten[
  Table[{x, y, z, -N@HeavisidePi[1.1 x]}, {x, -1, 1, 0.1}, {y, -1, 1, 
    1}, {z, -1, 1, 1}], 2]

In which I used -N@HeavisidePi[1.1 x], its plot is

enter image description here

If I plot this

ListSliceDensityPlot3D[data, {"XStackedPlanes", Subdivide[-1, 1, 20]},
  PlotLegends -> Automatic]

This will gives

enter image description here

This is right.

However If I plot only two surface at x=-0.5 and x=0.5

ListSliceDensityPlot3D[data, {"XStackedPlanes", {-0.5, 0.5}}, 
 PlotLegends -> Automatic]

This will give wrong plot

enter image description here

Only plot one surface is also not right.

ListSliceDensityPlot3D[data, {"XStackedPlanes", {-1}}, 
 PlotLegends -> Automatic]

enter image description here

What is wrong?

I am using Mathematica 10.4.0.0

$\endgroup$
4
  • $\begingroup$ Definitely a bug, you can use Table[] though, that works. $\endgroup$
    – Feyre
    Aug 7, 2016 at 14:57
  • $\begingroup$ @Feyre Hi, Feyre. What do you mean by using Table[]? $\endgroup$
    – matheorem
    Aug 7, 2016 at 15:41
  • $\begingroup$ It seemed my solution just made the two bugs interfere. To be honest, I don't really think ListSliceDensityPlot3D is designed for these circumstances, but I'd report it as a bug. $\endgroup$
    – Feyre
    Aug 7, 2016 at 16:57
  • $\begingroup$ @Feyre Thank you for reporting, Feyre. $\endgroup$
    – matheorem
    Aug 8, 2016 at 2:35

1 Answer 1

1
$\begingroup$

As a workaround to this bug, you can specify a color function directly and turn ColorFunctionScaling off.

With[
 {cf = ColorData[{"M10DefaultDensityGradient", {-1, 0}}]},
 ListSliceDensityPlot3D[data, {"XStackedPlanes", {-0.5, 0.5}},
  PlotLegends -> BarLegend[{cf, {-1, 0}}],
  ColorFunction -> cf,
  ColorFunctionScaling -> False]
 ]

Mathematica graphics

$\endgroup$
1
  • $\begingroup$ Thank you JasonB. I just noticed this post mathematica.stackexchange.com/q/97596/4742 Somehow, I think the problem in that post is quite similar to mine, maybe they are connected. This kind of bug is such a trap! They could easily mislead us into drawing wrong conclusion if we trust Mathematica. $\endgroup$
    – matheorem
    Aug 9, 2016 at 6:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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