As an example

  Flatten@Table[{i, j, k, If[Mod[i, 2] == 0, 1, 0]}, {i, 1, 5}, {j, 1,
      5}, {k, 1, 5}], 4],
 PlotLegends -> True]


enter image description here

But my data value are discrete and composed of only 0 and 1, I don't want ListDensityPlot3D to do interpolation for me.

I want something like the different between

ListDensityPlot[Table[x y, {x, 0, 1, 0.1}, {y, 0, 1, 0.1}]]

enter image description here

ListDensityPlot[Table[x y, {x, 0, 1, 0.1}, {y, 0, 1, 0.1}], 
 InterpolationOrder -> 0]

enter image description here

So is there any way to make 3D density plot similar to InterpolationOrder->0 like ListDensityPlot?

  • $\begingroup$ I understand that ListDensityPlot3D does a smooth plot of the points represented. I find logical what MMA does, i.e., Interpolation. I think you should think about other plotting commands. In fact, I see that your points in the example are located in separated discrete planes, so what about ListPointPlot3D? Unless you want to do interpolation in those planes. In this case I suggest to combine with Show... $\endgroup$ – José Antonio Díaz Navas Apr 24 '18 at 10:35
  • $\begingroup$ Hi, @JoséAntonioDíazNavas. Thank you for reply. But I don't want something like ListPointPlot3D. I have updated my post, maybe it is clearer now $\endgroup$ – matheorem Apr 24 '18 at 13:25

maybe this?

  If[Mod[i, 2] == 0, 1, 0],
   {i, 1, 5}, {j, 1, 5}, {k, 1, 5}]], axes->True]

enter image description here

  • $\begingroup$ , Thank you so much, This works $\endgroup$ – matheorem Apr 25 '18 at 1:37

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.