Message Boards Message Boards

GROUPS:

[Solved] Display a graph and a Graphics object in the same Manipulate?

Posted 4 months ago
503 Views
|
3 Replies
|
2 Total Likes
|

Hi,

I'm trying to get plot a parametric plot next to a graphic on the same row. I'd like to have the plot only update up to the current value of the manipulate variable at each step, such that it is in sync with the graphic. (the graphic shows a pendulum, the plot should show it's y coordinate as a function of time) My current solution shows the plot and graphic side by side in braces ({ , }) and i'm not sure how to go about updating the graph.

any help would be appreciated.

thanks!

Evaluate[{
   GraphicsRow[{Graphics[{
       {Thick, Line[
         {{0, l}, {x1, y1}}]},
       {Red, Disk[{x1, y1}, 0.2]}
       }
      , PlotRange -> {{-l, l}, {-l, 2 l}}],
     ParametricPlot[{x1, y1} /. t0 -> a, {a, 0, T}, 
      PlotRange -> {{-1, 1}, {0, 1}}]
     }]
   }]
 , {t0, 0, T, AnimationRate -> 1, RefreshRate -> 60, 
  Appearance -> "Open"}]
3 Replies

I am not sure what the problem is. The following Manipulate updates both plots at the same time:

With[{x1 = t0, y1 = t0^2, l = 1, T = 1},
 Manipulate[
  Row[{Graphics[{{Thick, Line[{{0, l}, {x1, y1}}]}, {Red, 
       Disk[{x1, y1}, 0.2]}}, PlotRange -> {{-l, l}, {-l, 2 l}}], 
    Spacer[20], 
    ParametricPlot[{x1, y1} /. t0 -> a, {a, 0, T}, 
     PlotRange -> {{-1, 1}, {0, 1}}]}], {t0, 0, 1, AnimationRate -> 1,
    RefreshRate -> 60, Appearance -> "Open"}]]

What do you want to see? What is x1 and x2? What is l?

Did you mean something like this?

Manipulate[
 GraphicsRow[{
   Graphics[{Red, Circle[{0, 0}, .5]}],
   ParametricPlot[{a, a^2 - a}, {a, 0, T}, PlotRange -> {-1, 3}]
   }],
 {T, 1, 2.5}]
Posted 4 months ago

Looks like, this I simply had an un-needed extra set of braces inside the evaluate. It seems to work now. Thanks for the help!

animatedGif

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract