Mathematica: two animations, one slider

Click For Summary

Discussion Overview

The discussion revolves around creating synchronized animations in Mathematica using a shared slider. Participants explore issues related to frame sizes, unexpected behavior in the Manipulate function, and the need for self-contained code examples.

Discussion Character

  • Technical explanation
  • Exploratory
  • Debate/contested

Main Points Raised

  • One participant seeks to overlay two animations in Mathematica and have them respond to a single slider.
  • Another participant suggests a Manipulate example that uses Inset to combine plots, but it may not directly address the original request.
  • A participant reports an issue where some animation frames are unexpectedly rendered as Large despite specifying Medium, raising questions about the behavior of Manipulate.
  • Another participant describes a problem where Mathematica attempts to create an additional frame beyond the specified range, leading to warnings about non-existent frames.
  • One participant notes that the code provided in a previous post is not self-contained, indicating a need for clearer examples.
  • A participant mentions using Mathematica 7 and provides details about the data structure being used in their code, suggesting that adjustments to the data might resolve issues.

Areas of Agreement / Disagreement

Participants express various technical challenges and observations, but there is no consensus on solutions or the underlying causes of the issues raised.

Contextual Notes

Some participants mention specific versions of Mathematica and the structure of data being used, which may influence the behavior of the code. There are unresolved questions regarding the rendering of frame sizes and the unexpected creation of additional frames.

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.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 6 ·
Replies
6
Views
8K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K