Message Boards Message Boards

0
|
2265 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

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

Posted 4 years ago

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"}]
POSTED BY: Gal Winer
3 Replies
Posted 4 years 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

POSTED BY: Gal Winer

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 BY: Hans Dolhaine

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"}]]
POSTED BY: Gianluca Gorni
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