Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ipython slows down after plotting with pylab

Tags:

python

Hey I'm trying to make a simple plot in ipython using pylab, and it works! :) But as soon as I've run my script, and the plot appear, the ipython compiler seems to slow down a lot, when writing and in general.

Python 2.7.6 32-bit (My computer runs windows 8.1 64-bit maybe that's causing the problems?) Ipython 2.1.0

Here's the script I'm running:

import pylab

Sx = pylab.matrix([[0,1,0], [1,0,1], [0,1,0]])/pylab.sqrt(2)
Sy = pylab.matrix([[0,-1j,0], [1j,0,-1j], [0,1j,0]])/pylab.sqrt(2)
Sz = pylab.matrix([[1,0,0], [0,0,0], [0,0,-1]])

D = 2.87
g = 2
B = range(0,5)

HD = [ ]
for i in B:
H = D*Sz*Sz + i*g*Sz
EigenValues = pylab.diag(H)
HD.append(EigenValues)


pylab.figure()
pylab.plot(B, HD)
pylab.show()
like image 549
1233023 Avatar asked Dec 06 '25 19:12

1233023


1 Answers

I find the default plotting backend for iPython to be intolerably slow on my Windows 7 box. To get around this, I always use an alternate backend like Qt:

$ ipython --matplotlib

gives me the Using matplotlib backend: Qt4Agg which works ok, or even better - try the iPython qtconsole

 $ ipython qtconsole
like image 188
danodonovan Avatar answered Dec 10 '25 05:12

danodonovan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!