0

I'm trying to come up to speed on the animation functionality in pyplot. I've grabbed the example code given here: https://matplotlib.org/2.0.0/examples/animation/animate_decay.html

and I'm attempting to run it myself. The result I get is empty axes with no animation at all. My setup is anaconda 4.3, with python 3.6. Matplotlib is version 2.0.0, and I'm running this in a jupyter notebook. I've tried IE 11, Chrome 59 and Firefox 54 on both a windows 7 machine and a Mac.

2 Answers 2

1

If you're using Spyder, you need to change your Matplotlib backend by going to the menu

Tools > Preferences > IPython console > Graphics

and then selecting Automatic in the section called Graphics backend. After that, you need to restart Spyder or the kernel associated with the console you want this change to take effect on.

Sign up to request clarification or add additional context in comments.

Comments

0

A jupyter notebook would probably use the inline backend by default which cannot be animated (since it produces png images).

You may use the notebook backend to have the plot produced in an interactive notebook cell,

%matplotlib notebook 

or the Tk backend to get a new window with the animation popping up,

%matplotlib tk 

If using matplotlib 2.1, you may also use the %matplotlib inline backend and show the animation as JavaScript,

from IPython.display import HTML HTML(ani.to_jshtml()) 

1 Comment

Brilliant. switching to the notebook backend worked perfectly. Thank you very much

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.