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.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With