Mathematica: two animations, one slider

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
5 replies · 4K views
MartinV
Messages
68
Reaction score
0
Hello everyone.

I have two animations in Mathematica, each with 187 frames. I would like to put one in a corner of the other and for them to share a slider so they both respond to it simultaneously.

Martin
 
Physics news on Phys.org
Try something like this:
Manipulate[
Plot[Cos[\[Omega] t], {t, -\[Pi], \[Pi]},
Epilog ->
Inset[Plot[Sin[\[Omega] t], {t, -\[Pi], \[Pi]},
ImageSize -> Small], {Right, Bottom}, {Right, Bottom},
Background -> Opacity[.7, White]]], {\[Omega], -3, 3}]
 
I've got an interesting problem with Manipulate. A few of the animation frames are Large while most of them are Medium. I explicitly said I want them Medium but they are still Large:

Manipulate[
Block[{spl =
ListLinePlot[Final, PlotRange -> {{-3, 3}, {1, 20}},
ImageSize -> Medium]},
Show[spl,
Graphics[{Red, PointSize[.02],
Point[{Final[[j, 1]], Final[[j, 2]]}]}], PlotLabel -> j]], {j, 1,
M, 1}]

Edit: weird that if I use PlotRange -> {{-1,1},{0,30}}, all frames are Medium. Why does this happen?
 
Now I get another problem. Using the same code as before, I create a Manipulate animation. In a 100-frame animation Mathematica tries to create the 101st. It's always like this. When a graph is formed, I get warnings that 101st frame doesn't exist, even though the counter in Manipulate command only goes to 100. When I move the slider away from 101, the warnings disappear and then the slider has the specified range. Only when I form it, it tries to show me more than possible.
 
I tried to run the code in post 3, but it is not self contained.

I have also had some difficulties in the past using Manipulate. What version of Mathematica are you using?
 
I'm using Mathematica 7.

The code in post #3 uses the Final table, which is 187*2. M is the length, in this case 187. First row of Final is a set of numbers going from -10 to 10; the second row are numbers between 1 and 30.

I think if you just make a few numbers and then put M as the length of that array then the code should work.