8

Currently, all my figures are inline. I wish to read the coordinates of my mouse locations in an interactive plot.

This answer here

In [2]: %pylab inline 
In [3]: plot(...)

In [4]: %pylab qt  # wx, gtk, osx or tk
In [5]: plot(...) 

does not work for me.

How to pop up an interactive matplotlib figure in IPython?

I am using Window 7 as OS.

1
  • 1
    Which IPython do you use? Does '%pylab qt' works at all at your box? Commented Nov 15, 2013 at 7:19

3 Answers 3

11

First you need to stop using %pylab. Whatever this command does is not reversible, meaning that you can't switch from inline to some other mode. This command was designed as transition tool and is not longer recommended. You can see more info in my other answer What is %pylab?.

If you want the ability to switch from inline to interactive mode for plots then use following at the start of your notebook:

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

When you want to have plot popout, just do this:

%matplotlib qt

You can switch back to inline mode again by doing:

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

Comments

3

To clarify the question, I believe you are asking about the IPython notebook, not the IPython command line interpreter.

In the notebook, as with the interpreter, the default is for plots to appear in a separate, interactive window. You are changing this default by calling

%pylab inline

If you remove that line (and also don't use the --pylab inline argument when you launch the notebook), then plots will appear in a separate window.

The comments on the answer you linked to indicate that switching back and forth between inline and not-inline doesn't work on all platforms.

Comments

2

You can do this: %matplotlib qt5

And when you want to switch back: %matplotlib inline

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.