From: John W. <jd...@go...> - 2003-11-21 22:55:47
|
Thanks, that worked for being able to generate the [1,2,3] plot from within my application. Eventually I will want to embed into a wxFrame, but for now I think this should suffice. I'm actually on linux, and am using 0.32 for now. I will get the latest CVS when I am up and running. When do you expect to release the next version? Thanks again, jgw >>>>>> "John" == John Wohlbier <jd...@go...> writes: > > John> Hi, I am building a wxPython app, and would like to try > John> incorporating matplotlib, even though the wx backend is > John> reportedly in its development state. Could someone please > John> give a snippet of code using the wx backend? Also, do I need > John> pygtk even though I intend on using wxPython? > > The matplotlib code you write is more or less backend independent > (same for gtk, wx, ps, etc..). You do not need pygtk. You just need > wxpython and Numeric - which are both included in the enthought > edition of python for win32, by the way; http://enthought.com/python. > > If you just want to make some figure windows to explore the plotting > commands, you have 2 choices > > import matplotlib > matplotlib.use('WX') > from matplotlib.matlab import * > plot([1,2,3]) > show() > > or > # myscript.py > from matplotlib.matlab import * > plot([1,2,3]) > show() > > > python myscript.py -dWX > > That is, you choose the wx backend either by doing 'use' or -dWX. See > http://matplotlib.sourceforge.net/backends.html for more info. > > See the examples dir of the src distro for examples of how to make plots > more sophisticated than [1,2,3]. > > But I gather from your post that you want to see an example of > embedding the plot in an application. Jeremy, the wx backend > implemented, can probably help you more here. In the mean time, you > might want to look at the FigureManagerWX class in the file > matplotlib/backends/backend_wx.py to see how to embed a plot in a wx > frame. > > I recommend you use the latest CVS, which has a number of improvements > over the 0.32 release. If you don't have CVS access, let me know and > I'll send you a snapshot (are you on windows). > > John Hunter |