Search code examples
wolfram-mathematica

Could not combine the graphics objects in Show[


I get this error for the Show method, why? :/

sol = First@
  NDSolve[{eq1ad, eq2ad, eqrad} U CondizioniIniziali, {q1, q2, 
    qr}, {t, 0, T}]

p1 = ParametricPlot3D[
  {xE, yE, zE} /. sol,
  {t, 0, T},
  AxesLabel -> {"x[t]", "y[t]", "z[t]"},
  BoxRatios -> {1, 1, 1},
  PlotStyle -> Red
  ]    

Manipulate[
 Show[
  p1,
  ListLinePlot[
   {{0, 0, 0}, {xB, yB, zB}, {xE, yE, zE}} /. sol /. t -> time,
   PlotStyle -> {Thick, Red}
   ]
  ],
 {time, 0, T}
 ]

Is it maybe because I can't combine a ParametricPlot3d with Show?


Solution

  • I think you are trying to combine a 2D ListLinePlot with a 3D ParametricPlot3D. Reading the documentation for ListLinePlot seems to show that it only accepts 2D points, not 3D points.

    You might be able to adapt something like this

    T=2;
    p1 = ParametricPlot3D[{Sin[t],Cos[t],t^2}, {t,0,T}];
    Show[p1, Graphics3D[ Line[{{0, 0, 0}, {1/2,1/2,2}, {1/3, 1/3,3}}]]]
    

    which can turn a list of 3D points into a Line into a Graphics3D and then combine that your ParametricPlot3D