Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a plot which is rather expensive to "present", and I want to create an animation on top of it.

EDIT:

"present" here does not just mean create the plot, but also to rasterize and present in on the Notebook.

I tried to create the plot before by doing plot=Plot[...] and then use Show[plot,Animate[...]], but Mathematica does not allow to combine plots with Animations. If I put the plot inside the animation, it gets really slow as it re-renders the plot at each frame.


Another thing I tried was to present the plot as an background image of the animation, but I'm not being able to make backgrounds other than RGBColors (and I don't even know if this works).

Is there any proper way of achieving this?


EDIT2:

One example of such plot

plot = ContourPlot[Cos[x] + Cos[y], {x, 0, 4 Pi}, {y, 0, 4 Pi}, 
PlotPoints -> 200, MaxRecursion -> 2, Mesh -> None];

The number of PlotPoints is big because in my particular case the function to be plotted is non trivial, and requires a lot of resolution to see anything. (I'm not putting here the code because the function is obtained as an iterative process, and is out of the scope of this question)

share|improve this question
1  
Can you provide the plot, or someting equivalent? –  Yves Klett Jan 4 '13 at 9:50
1  
If rendering of your Plot takes too much time, consider Rasterizeing it. –  Yves Klett Jan 4 '13 at 10:30
    
I think this is due to Rasterize use the pixel coordinate system of the image, while un-rasterized uses its own system. –  J. C. Leitão Jan 4 '13 at 11:02
    
@J.C.Leitão true - perhaps someone can help out here with a nifty solution. O –  Yves Klett Jan 4 '13 at 11:11

1 Answer 1

Can't you make the Plot on the side first, then add it later? Since it is already made then no extra cost.

p = Plot[Sin[x], {x, -Pi, Pi}];  (*make the expensive plot *)
Animate[Show[p, Plot[Cos[a x], {x, -Pi, Pi}]], {a, .1, 1, .1}]
share|improve this answer
    
"It is expensive to "present"": it is expensive to mathematica rasterize it to show on the notebook. When Mathematica animates, it apparently re-rasterizes all inside the Animate[] function. I want to have an animation on top of a 1-time rendered plot. –  J. C. Leitão Jan 4 '13 at 9:46
    
I've added some information on the question to clarify your point. –  J. C. Leitão Jan 4 '13 at 9:49
    
Maybe not rendering, more like rastering: at some point mathematica has to transform its data on a data able to be plotted. This is an expensive operation: try the example I added on the question (by e.g. changing the number of PlotPoint's). –  J. C. Leitão Jan 4 '13 at 10:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.