plotting - ListContourPlot and ListContourPlot3D use better interpolation for arrays of values than for lists of tuples (i.e. {{x,y,z,f[x,y,z]}..}
From reading the documentation, it seems that ListContourPlot3D should work equally well on an array versus a list of tuples,
?ListContourPlot3D
ListContourPlot3D[array] generates a contour plot from a three-dimensional array of values. ListContourPlot3D[{{$x_1$,$y_1$,$z_1$,$f_1$},{$x_2$,$y_2$,$z_2$,$f_2$},$\ldots$}] generates a contour plot from values defined at specified points in three-dimensional space.
But below the plot on the left uses the tuples version while the plot on the right uses the array,
dta = Table[{x, y, z, x^3 + y^2 - z^2}, {z, -2, 2, .1}, {y, -2,
2, .1}, {x, -2, 2, .1}];
Grid[{{ListContourPlot3D[Flatten[dta, 2], Contours -> {0},
Mesh -> None],
ListContourPlot3D[dta[[All, All, All, -1]], Contours -> {0},
Mesh -> None, DataRange -> {#, #, #} &@{-2, 2}]}}]
The interpolation used for the array version is clearly superior. Why is this? InterpolationOrder
is not an option for ListContourPlot3D
(even an undocumented one). Applying the option MaxPlotPoints -> 120
produces this monstrosity
This problem seems to affect the output of ListContourPlot
a little bit differently. Without using InterpolationOrder
, they give the same output (top row below), but if I do use InterpolationOrder
, it only has an effect on the array, not the tuples.
dta = Table[{x, y, x^3 + y^2}, {y, -2, 2, .2}, {x, -2, 2, .2}];
Grid[{{ListContourPlot[Flatten[dta, 1], Contours -> 20],
ListContourPlot[dta[[All, All, -1]], Contours -> 20]},
{ListContourPlot[Flatten[dta, 1], Contours -> 20,
InterpolationOrder -> 3],
ListContourPlot[dta[[All, All, -1]], Contours -> 20,
InterpolationOrder -> 3]}}]
Comments
Post a Comment