[IPython-User] qtconsole

Matthias BUSSONNIER bussonniermatthias@gmail....
Thu Aug 30 07:00:37 CDT 2012

Hi Francesco,

Le 28 août 2012 à 16:01, Francesco Montesano a écrit :

> Dear Ipythoners,
> I have just begun to use the qtconsole to mostly because I want to see
> if vim-ipython (https://github.com/ivanov/vim-ipython) helps to speed
> me up when doing matplotlib plots and checks from the console.
> Up to now I've always used standard ipython (version 0.12.1)
> As I almost always use numpy and matplotlib I've set in the ipython_config.py
> lines = """
> import numpy as np
> import matplotlib.pyplot as plt
> plt.ion()
> print("")
> print("Numpy and matplotlib.pyplot imported as np and plt. Interactive mode on")
> """

--pylab already import numpy as np and pyplot as plt.

> so that I start ipython with my standard setting. (If it is of any
> use, my default matplotlib backend is Qt4Agg)
>> From my understanding to have ipython qtconsole to show up a window
> with matplotlib plot I have to call it with the --pylab option or to
> use %pylabe inside the console.
> The probelm (ipython qtconsole --pylab):
> take the following scritp:
> #####test.py#####
> import matplotlib.pyplot as plt
> plt.plot( [1,2,3], label='test' )
> plt.legend()
> plt.draw()
> ###end test.py###
> If I paste the lines in the qtconsole the plot shows up as expected
> If I do %run test.py nothing shows up and if afterwards I try to plot
> anything else nothing happens.
> But if I substitute plt.draw() with plt.show() or if I call the latter
> in the console the plot is shown and then I can continue adding lines,
> making other figures etc.
> This behaviour shows up also in the the notebook. However in the
> standard ipython terminal I don't need the show command to have the
> plot window pop out.

I do have the difference of showing figure when using %run vs copy and paste
but I'm not totally surprised if I understand correctly how the %run command is supposed 
to work. (script is executed in an empty namespace, so I guess the display hook don't have effect) 

Unfortunately I can't the **difference** of behavior between 2process fronted and  normal python terminal on Os X.
Figures never show for me if I don't specify plt.show() while using run.

Maybe it has been fixed in more recent release.

> I see it as an inconsistency between the three "interfaces" of
> ipython, but I don't know if this is a bug or something intrinsic in
> the qtconsole and notebook.
> Can anyone enlighten me on this? Thanks

Could you try on a more recent version to see if it's still present,
Could you also file a bug report on github ? We are kind of low bandwidth right now
and might forget thread on the ML.


> Cheers,
> Francesco
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user

More information about the IPython-User mailing list