0
$\begingroup$

how can i combine thats plots:

p1 = ContourPlot3D[
 x^2 + y^2 + 100*(z - 11)^2 == 1, {x, -1, 1}, {y, -1, 1}, {z, 11, 
  11.3}]
p2 = Manipulate[
 VectorPlot3D[{0, 0, -b^3 (x^2 + y^2) Cos[b^2 (x^2 + y^2)]}, {x, -1, 
   1}, {y, -1, 1}, {z, 11, 11.3}], {b, 0.01, 3}]
Show[p1,p2]

i tried the "Show" function.

$\endgroup$
  • 4
    $\begingroup$ This seems to be a duplicate of your other question: How to combine Graphics $\endgroup$ – C. E. Jun 21 at 18:36
  • $\begingroup$ no its not beacuse Show doesnt work here $\endgroup$ – amit Jun 21 at 19:00
  • $\begingroup$ Show does work here. If you provide an example of how you used Show, then we can tell you what’s wrong. (A likely mistake is that you are putting Manipulate, which is not a type of graphics, inside Show, rather than Show inside Manipulate.) $\endgroup$ – C. E. Jun 21 at 19:09
  • $\begingroup$ i update my code. if i cant use Manipulate inside Show how can i still controll the parmeter b $\endgroup$ – amit Jun 21 at 19:23
  • $\begingroup$ As @C.E. said, the Show needs to be inside the Manipulate. Manipulate[Show[VectorPlot3D[...], p1], {b, 0.01, 3}]. $\endgroup$ – Rohit Namjoshi Jun 21 at 23:52
1
$\begingroup$
Clear["Global`*"]

cp3d = ContourPlot3D[
   x^2 + y^2 + 100*(z - 11)^2 == 1,
   {x, -1, 1}, {y, -1, 1}, {z, 11, 11.3}];

Manipulate[
 Show[
  cp3d,
  VectorPlot3D[
   {0, 0, -b^3 (x^2 + y^2) Cos[b^2 (x^2 + y^2)]},
   {x, -1, 1}, {y, -1, 1}, {z, 11, 11.3},
   PlotLegends -> Automatic,
   VectorPoints -> vp]],
 {{vp, 4, VectorPoints}, Range[2, 6]},
 {{b, 1}, 0.01, 3, Appearance -> "Labeled"}]

enter image description here

EDIT: Using a point pattern of "Mesh" gives much smaller arrows.

cp3d = ContourPlot3D[
   x^2 + y^2 + 100*(z - 11)^2 == 1,
   {x, -1, 1}, {y, -1, 1}, {z, 11, 11.3},
   ContourStyle -> Directive[Orange,
     Opacity[0.8], Specularity[White, 30]]];

Manipulate[
 Show[
  cp3d,
  VectorPlot3D[
   {0, 0, -b^3 (x^2 + y^2) Cos[b^2 (x^2 + y^2)]},
   {x, -1, 1}, {y, -1, 1}, {z, 11, 11.3},
   VectorPoints -> {ppat, vp},
   VectorAspectRatio -> var]],
 {{ppat, "Mesh", "Point Pattern"}, 
   {"Hexagonal", "FaceCenteredCubic", "Mesh", "Regular"}},
 {{vp, 2, VectorPoints}, Range[2, 6],
  ControlType -> SetterBar},
 {{var, 1.5, VectorAspectRatio}, 0.1, 2, 0.05,
  Appearance -> "Labeled"},
 {{b, 1}, 0.01, 3, Appearance -> "Labeled"}]

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ Do you know how to scale the vectors down in the z direction? I can't figure it out for the life of me. I've tried VectorScaling / VectorSizes to no avail. $\endgroup$ – flinty Jun 21 at 20:00
  • $\begingroup$ @flinty its an argument within Arrow. I think that link should clarify it. $\endgroup$ – CA Trevillian Jun 22 at 1:15
  • $\begingroup$ the code which was editted Fails to work. $\endgroup$ – amit Jun 22 at 6:47
  • $\begingroup$ i mean VectorAspectRatio is not working with VectorPlot3D $\endgroup$ – amit Jun 22 at 12:08
  • $\begingroup$ @amit - the documentation indicates that VectorAspectRatio is new in v12.1. Presumably, you have an earlier version. Just delete that option and the corresponding control. $\endgroup$ – Bob Hanlon Jun 22 at 13:06

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