Use both matplotlib inline and qt in jupyter notebook
Question: I am using Jupyter (with IPython) to analyze research data, as well as export
figures. I really like the notebook approach offered by Jupyter: when I
revisit an experiment after a long time, I can easily see how the figures
correspond to the data. This is of course using the inline backend.

However, when I want to explore new data, I prefer to use the QT backend. It
is faster than the inline one, and allows to easily scale, zoom in and out,
and nicely displays the X and Y coordinates in the bottom left corner.
Moreover, I can use the QT backend to determine good x and y limits to use in
the inline backend.

I have tried using the `%matplotlib notebook` magic, but it is simply too
slow. For some experiments I am plotting ~500 spectra (each consists of ~1000
data points), which is already slow in the inline backend. Even with less data
points, the notebook backend is just too slow to use.

Therefore, I would like to use both the QT backend, and the inline backend
whenever I plot something. (So, whenever I execute a cell which plots data, it
should both display the inline image, and pop up a QT backend window). This
way, I still have a nice overview of plots in my notebook, while also allowing
me to easily explore my data. Is there a way to achieve this?


Answer: This allows you to run QtConsole, plotting with the plotSin function, both
inline and through the QtConsole.

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

..

    
    
    def plotChirp(Type, Exp, Rand):
    
        # Orignal Chirp Funciton From:
        # http://stackoverflow.com/questions/19410042/how-to-make-ipython-notebook-matplotlib-plot-inline
        x = np.linspace(0, 3*np.pi, Rand)
        plt.plot(x, np.sin(x**int(Exp)))
        plt.title('A simple chirp ' + Type)
        plt.show()
    

..

    
    
    plotChirp("A", 5, 200) # Plots inline if you choose
    

[![enter image description
here](http://i.stack.imgur.com/9A4Xa.jpg)](http://i.stack.imgur.com/9A4Xa.jpg)

    
    
    %connect_info # For your own connection
    %qtconsole
    

QtConsole opens and now you can call your function to plot externally..

[![enter image description
here](http://i.stack.imgur.com/73Zr4.jpg)](http://i.stack.imgur.com/73Zr4.jpg)

Using `%matplotlib qt` allows for printing in a loop, but unfortunately it
seems to overlap the plots. Looking into subplots as a possible solution.

    
    
    %matplotlib qt
    for i in range(0,2):
    
        if i == 0:
            plotChirp("B",1, 400)
        else:
            plotChirp("c",6, 1000)
    

[![enter image description
here](http://i.stack.imgur.com/2cgAG.jpg)](http://i.stack.imgur.com/2cgAG.jpg)

