2
$\begingroup$

I am trying to get multiple StreamSlice in 3D and have a little confusion getting there. I would like slices in the xy plane, yz plane and xz plane. I would also like the ability to pick any plane. I am getting two plane slices, but when I try to get into the other plane I am unable to do so. Also, I am not sure what Append and Prepend do in the Arrow function. At first I thought it was appending lines, but if I change the code to Prepend[#,1] it shifts the plane over. The following is similar to my code:

ft[x_, y_, z_] := {y, -x, z}


gr1 = Graphics3D[(First@
  StreamPlot[ft[x, y, 0][[{1, 2}]], {x, -3, 0}, {y, -3, 3}]) /. 
  Arrow[pts_] :> Arrow[Line[Append[#, 0] & /@ pts]]];
gr2 = Graphics3D[(First@
  StreamPlot[ft[0, y, z][[{1, 3}]], {y, -3, 3}, {z, 0, 3}]) /. 
  Arrow[pts_] :> Arrow[Line[Prepend[#, 0] & /@ pts]]];
gr3 = Graphics3D[(First@
  StreamPlot[ft[x, 0, z][[{2, 3}]], {x, -3, 0}, {z, 0, 3}]) /. 
  Arrow[pts_] :> Arrow[Line[Prepend[#, 0] & /@ pts]]];

Show[gr1, gr2, gr3]

enter image description here

I think from the code you can see what I am trying to get at. I want the last graph gr3 to be in the xz plane.

$\endgroup$
1
$\begingroup$
gr3 = Graphics3D[(First @ StreamPlot[ft[x, 0, z][[{2, 3}]], {x, -3, 0}, {z, 0, 3}]) /. 
    Arrow[pts_] :> Arrow[Insert[#, 0, 2] & /@ pts]];

Show[gr1, gr2, gr3]

Mathematica graphics

Or, use Arrow[Riffle[#, 0] & /@ pts] instead of Arrow[Insert[#, 0, 2] & /@ pts]].

| improve this answer | |
$\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.