Edited thanks to @Kuba:
In the following example, ListContourPlot3D accepts an array of points spaced at intervals 0.1 apart throughout the volume, but seems to choose an arbitrary number of points for generating a mesh. Setting MaxPlotPoints
explicitly works to a limited extent. How can I force it to use all points without specifying that number by hand?
gauss = Partition[
Flatten[Table[{i, j, k, Exp[-i^2 - j^2]}, {i, -2, 2, 0.1}, {j, -2,
2, 0.1}, {k, -2, 2, 0.1}]], 4];
GraphicsRow[{
ListContourPlot3D[gauss, Contours -> {0.5},
ContourStyle -> Opacity[0.5], AxesLabel -> {x, y, z}],
ListContourPlot3D[gauss, Contours -> {0.5},
ContourStyle -> Opacity[0.5], AxesLabel -> {x, y, z},
MaxPlotPoints -> 20],
ListContourPlot3D[gauss, Contours -> {0.5},
ContourStyle -> Opacity[0.5], AxesLabel -> {x, y, z},
MaxPlotPoints -> Infinity]
}, ImageSize -> 800]
Edit thanks to @Rahul:
For a 3D array (with the right order of indices) we get the right behavior. Does this mean the 4D syntax constructs the mesh in a fundamentally different way?
gauss = Table[Exp[-i^2 - j^2], {k, -2, 2, 0.1}, {j, -2, 2, 0.1}, {i, -2, 2, 0.1}];
ListContourPlot3D[gauss, Contours -> {0.5}, ContourStyle -> Opacity[0.5],
AxesLabel -> {x, y, z}, DataRange -> {{-2, 2}, {-2, 2}, {-2, 2}}]
Edit thanks to @Szabolcs:
Increasing MaxPlotPoints
constructs the mesh with some strange regularities (and appears to slow it down):
GraphicsGrid[
Partition[
Table[ListContourPlot3D[gauss, Contours -> {0.5},
ContourStyle -> Opacity[0.5], AxesLabel -> {x, y, z},
MaxPlotPoints -> i, ImageSize -> 200,
PlotLabel ->
Style[StringJoin["MaxPlotPoints->", ToString[i]], 16, Bold]], {i,
18, 38, 4}], 3, 3, 1, Null], ImageSize -> 800]
RandomSample[gauss, Length[gauss]]
$\endgroup$ListContourPlot
(which is much faster so more convenient to play with), it seems that withMaxPlotPoints -> Infinity
it does in fact include all points in the simple examples I tried (maybe not in more complicated ones). You can see this clearly if you useMesh->All
. However, if I useMaxPlotPoints -> 50
or some other high value like that, then it included more points than I gave it. Probably it generates them using interpolation. You can even control it usingInterpolationOrder
. $\endgroup$InterpolationOrder
. If you give it values at arbitrary locations in 3D space, it will compute a Delaunay tessellation first and use that as the basis of the interpolation (which I think is limited to 1st or 0th order). So, I'm not sure what's going on, and I'm not saying that it does use all points in your example, but increasing MaxPlotPoints generates ... $\endgroup$ListContourPlot3D
does is simply useInterpolation
and invokeContourPlot3D
on the result? Just a guess. $\endgroup$