5
$\begingroup$

I have a lot of data points which represents a value at different points in different cross-sections of a container. I can use ListPlot3D or ListDensityPlot to get a view of each cross section. What I would like is a way to show the output of ListPlot3D or ListDensityPlot in a 3D stack so you can get an idea how the plots fit together.

I answered a much simpler question here that has sort of a similar effect except using graphics objects. However, it seems more difficult to me when you are using the result of a different plotting function.

Here are some example values for different cross-sections which can be given directly to ListPlot3D or ListDensityPlot

level1 = {{-2, -1, 1}, {-2, 0, 2}, {-2, 1, 1}, {-1, -2, 0}, {-1, -1, 2}, 
   {-1, 0, 2}, {-1, 1, 4}, {-1, 2, 3}, {0, -2, 1}, {0, -1, 2}, {0, 0, 3}, 
   {0, 1, 1}, {0, 2, 5}, {1, -2, 1}, {1, -1, 1}, {1, 0, 2}, {1, 1, 5}, 
   {1, 2, 5}, {2, -1, 0}, {2, 0, 3}, {2, 1, 4}}

level2 = {{-2, -1, 5}, {-2, 0, 3}, {-2, 1, 3}, {-1, -2, 0},{-1, -1, 4},      
   {-1, 0, 3}, {-1, 1, 0}, {-1, 2, 3}, {0, -2, 1}, {0, -1, 1}, {0,0, 2},
   {0, 1, 1}, {0, 2, 5}, {1, -2, 4}, {1, -1, 2}, {1, 0, 3}, {1, 1, 4},
   {1, 2, 3}, {2, -1, 5}, {2, 0, 3}, {2, 1, 4}}

level3 = {{-2, -1, 4}, {-2, 0, 4}, {-2, 1, 4}, {-1, -2, 2}, {-1, -1, 1},
   {-1, 0, 3}, {-1, 1, 0}, {-1, 2, 3}, {0, -2, 0}, {0, -1, 3}, {0,0, 0},
   {0, 1, 5}, {0, 2, 0}, {1, -2, 2}, {1, -1, 4}, {1, 0, 5}, {1, 1, 0}, 
   {1, 2, 2}, {2, -1, 1}, {2, 0, 1}, {2, 1, 2}}
$\endgroup$
5
$\begingroup$

you can try this:

 {p1, p2, p3} = 
      ListDensityPlot[#, ImageSize -> 400, Frame -> False] & /@ {level1, 
        level2, level3};

{poin1, poin2, poin3} = 
  MeshCoordinates[
      ConvexHullMesh[#[[;; , ;; 2]]]][[MeshCells[
        ConvexHullMesh[#[[;; , ;; 2]]], 2][[1, 1]]]] & /@ {level1, 
    level2, level3};

pol1 = {##, 0} & @@@ poin1;
pol2 = {##, 3} & @@@ poin2;
pol3 = {##, 6} & @@@ poin3;

ver = VertexTextureCoordinates -> 1/4 (2 + pol1[[;; , ;; 2]]);

Graphics3D[{{Texture[p1], Polygon[pol1, ver]}, {Texture[p2], 
   Polygon[pol2, ver]}, {Texture[p3], Polygon[pol3, ver]}}]

enter image description here

you can also try this:

level2[[;; , 3]] = level2[[;; , 3]] + 10;

level3[[;; , 3]] = level3[[;; , 3]] + 20;

Show[ListPlot3D[#, ImageSize -> 400, PlotRange -> {0, 30}, 
    ColorFunction -> "Rainbow", 
    ColorFunctionScaling -> True] & /@ {level1, level2, level3}, 
 BoxRatios -> 1]

enter image description here

$\endgroup$
7
$\begingroup$

I'm not sure how many levels you are talking about but if reasonably small you can scan through the different levels using Manipulate and use the level to set the opacity value.

Manipulate[
 DynamicModule[
  {
   opacity = ConstantArray[Opacity[0.2], 3]
   },

  opacity[[level]] = Opacity[1.0];

  ListPlot3D[{level1, level2, level3},
   PlotStyle -> opacity,
   Mesh -> None
   ]
  ],

 {{level, 1}, {1, 2, 3}}
 ]

This results in

Mathematica graphics

for the first level and

Mathematica graphics

for the second level ...

$\endgroup$
  • $\begingroup$ +1 for an interesting visualization, but not quite what I was looking for $\endgroup$ – BenP1192 Aug 6 '15 at 3:30

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.