2
$\begingroup$

I am plotting a 4D data (3D space, and time) and I would like to have control over each planes' number of contours. I already set the variables for that but I don't know how to set the contours separately.

 g4[x_, y_, z_, t_] := Sin[x] Cos[y] Sin[z] Exp[t];
 data7 = Table[
 Evaluate@N[g4[x, y, z, t]], {x, 0, 10., 1.}, {y, 0, 10., 1.}, {z, 
 0, 10., 1.}, {t, 0, 10., 1.}];
 Manipulate[
 If[planes === {}, planes = {"zy plane"}];
 ListSliceContourPlot3D[data7[[All, All, All, tijk]], 
 planes /. {"zy plane" -> {"XStackedPlanes", {i}}, 
 "zx plane" -> {"YStackedPlanes", {j}}, 
 "xy plane" -> {"ZStackedPlanes", {k}}}, 
 DataRange -> {{0, 10}, {0, 10}, {0, 10}}, 
 AxesLabel -> {Style["x", 13, Blue], Style["y", 13, Blue], 
 Style["z", 13, Blue]}],

 {{planes, "zy plane", 
 Style["Planes of Interest", 14, Black, Bold]}, {"zy plane", 
 "zx plane", "xy plane"}, TogglerBar},


 Grid[{
 {Row[{Control[{{tijk, 1, 
     Dynamic@Panel[
       Row[{Style["Time: ", Blue, 12], Style[tijk, Red, 12]}], 
       ImageSize -> {100, 45}]}, 1, 10, 1}], Spacer[10]}], 
SpanFromLeft},
{Style["  Position                      ", 14, Black, Bold], 
 Style["      # of Contours             ", 14, Black, Bold]},
{Row[{Control[{{i, 0, 
     Dynamic@Panel[
       Row[{Style["zy plane: ", Blue, 12], Style[i, Red, 12]}], 
       ImageSize -> {100, 45}]}, 0, 10, 1, 
    Enabled -> MemberQ[planes, "zy plane"]}], Spacer[10], 
  Control[{{counterx, 1, 
     Dynamic@Panel[
       Row[{Style[" ", Blue, 12], Style[counterx, Red, 12]}], 
       ImageSize -> {90, 40}]}, 1, 10, 1, 
    Enabled -> MemberQ[planes, "zy plane"]}]}], SpanFromLeft}, {

Row[{Control[{{j, 0, 
     Dynamic@Panel[
       Row[{Style["zx plane: ", Blue, 12], Style[j, Red, 12]}], 
       ImageSize -> {100, 45}]}, 0, 10, 0.1, 
    Enabled -> MemberQ[planes, "zx plane"]}], Spacer[10], 
  Control[{{countery, 1, 
     Dynamic@Panel[
       Row[{Style[" ", Blue, 12], Style[countery, Red, 12]}], 
       ImageSize -> {90, 40}]}, 1, 10, 1, 
    Enabled -> MemberQ[planes, "zx plane"]}]}], SpanFromLeft}, {

Row[{Control[{{k, 0, 
     Dynamic@Panel[
       Row[{Style["xy plane: ", Blue, 12], Style[i, Red, 12]}], 
       ImageSize -> {100, 45}]}, 0, 10, 0.1, 
    Enabled -> MemberQ[planes, "xy plane"]}], Spacer[10], 
  Control[{{counterz, 1, 
     Dynamic@Panel[
       Row[{Style[" ", Blue, 12], Style[counterz, Red, 12]}], 
       ImageSize -> {90, 40}]}, 1, 10, 1, 
    Enabled -> MemberQ[planes, "xy plane"]}]}], SpanFromLeft}}, 
    Dividers -> {False, True, False}],
    ContinuousAction -> False]
$\endgroup$

1 Answer 1

3
$\begingroup$

You can not specify different contour sets for different slices if you use a single ListSliceContourPlot3D. Instead, you can create a separate ListSliceContourPlot3D for each slice with the desired number of contours and combine them using Show:

Manipulate[Show[If[planes === {}, 
   ListSliceContourPlot3D[data7[[All, All, All, tijk]], 
    "CenterPlanes", ContourStyle -> None, ContourShading -> None, 
     BoundaryStyle -> None, BaseStyle -> White, 
     DataRange -> {{0, 10}, {0, 10}, {0, 10}}], 
    ListSliceContourPlot3D[data7[[All, All, All, tijk]], #[[1]], 
      Contours -> #[[2]], DataRange -> {{0, 10}, {0, 10}, {0, 10}}] & /@ 
    (planes /. {("zy plane") -> {{"XStackedPlanes", {i}}, counterx}, 
       "zx plane" -> {{"YStackedPlanes", {j}}, countery}, 
       "xy plane" -> {{"ZStackedPlanes", {k}}, counterz}})],
    AxesLabel -> {Style["x", 13, Blue], Style["y", 13, Blue],  Style["z", 13, Blue]}], 
   {{planes, {"zy plane"}, Style["Planes of Interest", 14, Black, Bold]}, {"zy plane", 
   "zx plane", "xy plane"}, TogglerBar}, 
 Grid[{{Row[{Control[{{tijk, 1, Dynamic@Panel[
           Row[{Style["Time: ", Blue, 12], Style[tijk, Red, 12]}], 
           ImageSize -> {100, 45}]}, 1, 10, 1}], Spacer[10]}], SpanFromLeft}, 
    {Style["  Position                      ", 14, Black, Bold], 
     Style["      # of Contours             ", 14, Black,  Bold]}, 
    {Row[{Control[{{i, 0, Dynamic@Panel[Row[{Style["zy plane: ", Blue, 12], 
           Style[i, Red, 12]}], ImageSize -> {100, 45}]}, 0, 10, 1, 
           Enabled -> Dynamic[MemberQ[planes, "zy plane"]]}], Spacer[10],
       Control[{{counterx, 1, Dynamic@Panel[
           Row[{Style[" ", Blue, 12], Style[counterx, Red, 12]}], 
           ImageSize -> {90, 40}]}, 1, 10, 1, 
           Enabled -> MemberQ[planes, "zy plane"]}]}], SpanFromLeft}, 
    {Row[{Control[{{j, 0, Dynamic@Panel[Row[{Style["zx plane: ", Blue, 12], 
          Style[j, Red, 12]}], ImageSize -> {100, 45}]}, 0, 10, 0.1, 
          Enabled -> MemberQ[planes, "zx plane"]}], Spacer[10], 
      Control[{{countery, 1, Dynamic@Panel[Row[{Style[" ", Blue, 12], 
          Style[countery, Red, 12]}], ImageSize -> {90, 40}]}, 1, 10, 1, 
          Enabled -> MemberQ[planes, "zx plane"]}]}], SpanFromLeft}, 
    {Row[{Control[{{k, 0, Dynamic@Panel[Row[{Style["xy plane: ", Blue, 12], 
          Style[i, Red, 12]}], ImageSize -> {100, 45}]}, 0, 10, 0.1, 
          Enabled -> MemberQ[planes, "xy plane"]}], Spacer[10], 
      Control[{{counterz, 1, Dynamic@Panel[Row[{Style[" ", Blue, 12], 
         Style[counterz, Red, 12]}], ImageSize -> {90, 40}]}, 1, 10, 1, 
        Enabled -> MemberQ[planes, "xy plane"]}]}], SpanFromLeft}}, 
  Dividers -> {False, True, False}], ContinuousAction -> False]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.