From: John H. <jdh...@ac...> - 2005-03-18 21:36:04
|
>>>>> "Russell" == Russell E Owen <ro...@ce...> writes: Russell> Thanks. That was helpful -- though also a bit confusing, Russell> in that I'm using the TkAgg back end and calling Russell> pylab.draw() doesn't update anything visible on my Russell> FigureCanvasAgg object. (As an aside, calling show() on Russell> my FigureCanvasAgg object seems to work -- the code Russell> originally did that when I got it -- but the manual and Russell> FAQ clearly point to using draw instead). I looked back over the code you posted previously and see that you are using the API, eg making your own tk canvases. In this case you should not import pylab at all. Do everything from the class API. Call canvas.draw() rather than pylab.draw(). You can still use matplotlib.numerix to get all the Numeric/numarray symbols, but the pylab interface doesn't mix well with the API interface because pylab tries to manage figure creation and destruction for you. Instead of f = figure(figsize=(3,3)) # this is a pylab call sp = f.add_subplot(111) canvas = FigureCanvasTkAgg(f, master=root) do from matplotlib.figure import Figure f = Figure(figsize=(3,3)) # this is an API call sp = f.add_subplot(111) canvas = FigureCanvasTkAgg(f, master=root) See also examples/agg_oo.py and this post for a tutorial introduction the matplotlib API http://sourceforge.net/mailarchive/message.php?msg_id=11033442 Hope this helps, JDH |