I wanted to use pylab for some interactive work (event handling etc), and to use wxpython to drag and drop file names, set parameters and the like. I didn’t really have time/was too lazy to learn how to use the matplotlib api, so I spent some time trying to get the 2 to work together. This works for me in Windows XP.
First, in your matplotlibrc file, set backend to WXAgg (the default TkAgg doesn’t work and WX is slower).
Or do
from matplotlib import use
use('WXAgg')
before you import pylab.
Some have said that you need to set interactive to True, but I prefer to use ion(), ioff() and force draw as follows:
ion() # turn interactive mode on else figure won’t display
figure() # new figure
ioff() # set all values first before drawing because this is slow otherwise
# insert plots etc here #
draw() # force redraw of the figure you’ve created
It seems like that’s all there is to it, though I may have forgotten something…
[…] | user-saved public links | iLinkShare 4 votesGetting wxPython and matplotlib’s pylab to work together>> saved by nanvan 1 days ago2 votesGetting matplotlib working on Ubuntu 6.06>> saved by kedder 6 […]
October 31st, 2008 at 9:06 am
Follow responses to this entry through the RSS 2.0 feed.
Both comments and pings are currently closed.