It has come to my attention that in Anaconda for Windows and Mac OS X, plots invoked from a Jupyter Notebook are non-interactive and embedded in the notebook instead of popping up in an independent interactive window.

Here is a way to get an interactive plot that supports zooming and panning and gives you the coordinates of the pointer.

Interactive plots in Windows

Stop Windows from hiding file extensions

windows_show_file_extensions.png

Uncheck "Hide extensions for known file types"

Open a Windows Command Prompt

Click the Window icon at the lower left corner of your screen and type "command": choose Command Prompt. A black window will appear.

Make a mental note of the folder that is the default working folder. (This is what is shown as the prompt. It might be something like "C:\Users\LadyGaga".)

Make a plain text file version of the Python code

Open "Notepad", and copy and past the Python code into it. Use "Save As ..." to save the file in the working folder noted above as "plot_spectrum.py".

Notepad will tack on a ".txt" extension that we don't want.

Remove .txt extension

Using your file explorer, remove the ".txt" extension from your Python code file by renaming it.

Click "Yes" when it asks you if you really want to do this.

Move the sound file to the working folder

Using the file explorer, move the .wav file to same folder you put your .py file in.

Run your code

In the Command Prompt, type

python plot_spectrum.py

Your interactive graphics window should pop up. Clicking the magnifying-glass button allows you to zoom to a rectangle of your choice. The arrow button beside that allows you to pan across your plot. The "home", "back" and "forward" buttons allow you to re-visit previous views.

Improvements

Any suggestions from Windows experts on improving this procedure would be most appreciated.

Mac users

Do a similar process. You use a "terminal" instead of a "Command Prompt", and your default text editor is called "textedit" instead of "notepad".