How to convert a ListContourPlot into a primitive usable with Graphics3D?
Consider modifying your data by adding a dummy $z$ value, used as a sort of index to each dataset, then using ListSliceContourPlot3D
:
Flatten[{{#1, #2, -3, #3}& @@@ data, {#1, #2, 3, 2 #3}& @@@ data}, 1];
ListSliceContourPlot3D[
%,
{"ZStackedPlanes", {-3, 3}},
PlotRange -> {Automatic, Automatic, {-6, 6}}
]
Here I am arbitrarily positioning your original data on the $z=-3$ plane; then creating a new dataset by simply multiplying your original $z$ values by an arbitrary constant, just to have something else to plot.
Here is another possibility if you really want to use Graphics3D
with 2D contour plots. I think MarcoB's answer is probably the best, but it might depend on exactly what you're doing with your data.
I define dat
to be the data you linked to on PasteBin.
plot = ListContourPlot[dat, AspectRatio -> 1/2,
ColorFunction -> "TemperatureMap", PlotRangePadding -> 0]
Show[
Graphics3D[{
Texture[plot],
Polygon[{{0, 0, 0}, {2, 0, 0}, {2, 1, 0}, {0, 1, 0}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
Texture[plot],
Polygon[{{0, 0, 0.5}, {2, 0, 0.5}, {2, 1, 0.5}, {0, 1, 0.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
Texture[plot],
Polygon[{{0, 0, 1}, {2, 0, 1}, {2, 1, 1}, {0, 1, 1}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]
}],
Lighting -> {"Ambient", White}
]
Using the Texture
option in Graphics3D
, I can add the plot as the texture of a 2D polygon in 3D space. I believe it will stretch the texture to fit the polygon as long as you specify the VertexTextureCoordinates
to be the 4 corners.
Of course you can make the white border transparent if you prefer, and other tweaks like changing the aspect ratio, etc.