1
$\begingroup$

I have two different 3D Plots that I what to be overlayed and manipulated at the same time. Specifically:

p1 = Manipulate[
  ContourPlot3D[
   1 - a11 P - a12 B - a13 i == 0, {P, 0, 1}, {B, 0, 1}, {i, 0, 1}, 
   ContourStyle -> Directive[Opacity[0.5], Brown], 
   Mesh -> None], {{a11, 1}, 0, 2}, {{a12, 1}, 0, 2}, {{a13, 1}, 0, 2}]
p2 = Manipulate[
  ContourPlot3D[
   1 - a21 P - a22 B - a23 i == 0, {P, 0, 1}, {B, 0, 1}, {i, 0, 1}, 
   ContourStyle -> Directive[Opacity[0.5], Brown], 
   Mesh -> None], {{a21, 1}, 0, 2}, {{a22, 1}, 0, 2}, {{a23, 1}, 0, 2}]

Without manipulate I can overlay them easily

p1 = ContourPlot3D[
   1 - 0.5 P - 1.2 B - 0.5 i == 0, {P, 0, 1}, {B, 0, 1}, {i, 0, 1}, 
   ContourStyle -> Directive[Opacity[0.5], Brown], Mesh -> None];
p2 = ContourPlot3D[
   1 - P - 0.3 B - 0.1 i == 0, {P, 0, 1}, {B, 0, 1}, {i, 0, 1}, 
   ContourStyle -> Directive[Opacity[0.5], Brown], Mesh -> None];
Show[p1, p2]

enter image description here

How can I do the same but with manipulate?

Notes

  • If you need clarification feel free to ask.
$\endgroup$
  • 1
    $\begingroup$ Manipulate[Show[{ ContourPlot3D[ 1 - a11 P - a12 B - a13 i == 0, {P, 0, 1}, {B, 0, 1}, {i, 0, 1}, ContourStyle -> Directive[Opacity[0.5], Brown], Mesh -> None], ContourPlot3D[ 1 - a21 P - a22 B - a23 i == 0, {P, 0, 1}, {B, 0, 1}, {i, 0, 1}, ContourStyle -> Directive[Opacity[0.5], Brown], Mesh -> None] }], {{a11, 1}, 0, 2}, {{a12, 1}, 0, 2}, {{a13, 1}, 0, 2}, {{a21, 1}, 0, 2}, {{a22, 1}, 0, 2}, {{a23, 1}, 0, 2}] $\endgroup$ – egwene sedai Feb 11 at 21:56
3
$\begingroup$

Use one Manipulate

enter image description here

Manipulate[
 Module[{p1, p2, i, B, p},
  p1 = ContourPlot3D[
    1 - a11 P - a12 B - a13 i == 0, {P, 0, 1}, {B, 0, 1}, {i, 0, 1}, 
    ContourStyle -> Directive[Opacity[0.5], Brown], Mesh -> None
    ];
  p2 = ContourPlot3D[
    1 - a21 P - a22 B - a23 i == 0, {P, 0, 1}, {B, 0, 1}, {i, 0, 1}, 
    ContourStyle -> Directive[Opacity[0.5], Brown], Mesh -> None
    ];
  Show[p1, p2]
  ],
 {{a11, 1}, 0, 2},
 {{a12, 1}, 0, 2},
 {{a13, 1}, 0, 2},
 {{a21, 1}, 0, 2},
 {{a22, 1}, 0, 2},
 {{a23, 1}, 0, 2},
 TrackedSymbols :> {a11, a12, a13, a21, a22, a23}
 ]
$\endgroup$
1
$\begingroup$

You can also use a single ContourPlot using Evaluate[1 - {{a11, a12, a13}, {a21, a22, a23}}.{P, B, i}] as the first argument:

Manipulate[ContourPlot3D[Evaluate[1 - {{a11, a12, a13}, {a21, a22, a23}}.{P, B, i}], 
   {P, 0, 1}, {B, 0, 1}, {i, 0, 1}, 
   ContourStyle -> (Opacity[0.5, #] & /@ {Brown, Blue}), 
   Mesh -> None, ViewPoint -> {2.5, 1, 2}], 
 Grid[Transpose@
    {{Control@{{a11, .5}, 0, 2}, Control@{{a12, 1.2}, 0, 2}, Control@{{a13, .5}, 0, 2}}, 
     {Control@{{a21, 1}, 0, 2}, Control@{{a22, .3}, 0, 2}, Control@{{a23, .1}, 0, 2}}}], 
 TrackedSymbols :> {a11, a12, a13, a21, a22, a23}, Alignment -> Center]

enter image description here

$\endgroup$

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.