SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: John W. <jd...@go...> - 2003年11月21日 20:44:42
Hi,
I am building a wxPython app, and would like to try
incorporating matplotlib, even though the wx backend
is reportedly in its development state.
Could someone please give a snippet of code using
the wx backend? Also, do I need pygtk even though I
intend on using wxPython?
Thanks!
jgw
From: John H. <jdh...@ac...> - 2003年11月21日 22:32:24
>>>>> "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
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
From: John H. <jdh...@ac...> - 2003年11月21日 23:17:15
>>>>> "John" == John Wohlbier <jd...@go...> writes:
 John> Thanks, that worked for being able to generate the [1,2,3]
 John> plot from within my application. Eventually I will want to
 John> embed into a wxFrame, but for now I think this should
 John> suffice.
I know Jeremy is planning on writing some example code to show how to
embed wx in an application with or without the navigation toolbar, and
possibly provide some utility classes to make it really easy.
If you have bug reports or suggestions for improvement regarding the
wx backend, the best place to send them is the matplotlib-dev mailing
list - http://sourceforge.net/mailarchive/forum.php?forum_id=36187.
There is a list of known bugs in header of the backend_wx.py code.
 John> I'm actually on linux, and am using 0.32 for now. I will get
 John> the latest CVS when I am up and running. When do you expect
 John> to release the next version?
We're shooting for early December.
JDH
From: John W. <jd...@go...> - 2003年11月21日 23:18:57
I ended up downloading the latest CVS using the command
cvs -z3 -d:pserver:ano...@cv...:/cvsroot/matplotlib co
matplotlib
and doing python setup.py install
Now when I run my application (which worked with version 0.32) I get
this error on startup
Traceback (most recent call last):
 File "./mptwt.py", line 3, in ?
 from mp_win import *
 File "./mp_win.py", line 10, in ?
 from matplotlib.matlab import *
 File "/usr/lib/python2.2/site-packages/matplotlib/matlab.py", line 121,
in ?
 from axes import Subplot, Axes
 File "/usr/lib/python2.2/site-packages/matplotlib/axes.py", line 118, in ?
 import backends
 File "/usr/lib/python2.2/site-packages/matplotlib/backends/__init__.py",
line 21, in ?
 from backend_wx import AxisText, Figure, FigureManager, Gcf, \
 File
"/usr/lib/python2.2/site-packages/matplotlib/backends/backend_wx.py",
line 164, in ?
 from matplotlib._matlab_helpers import FigureManagerBase, GcfBase
ImportError: cannot import name FigureManagerBase
Am I doing something wrong? I guess I'll go back to version 0.32
for a while.
By the way, when I run the python setup.py install command will
the script properly overwrite the existing version of the matplotlib
library, or should I go in and delete the old library first?
Thanks!
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
From: John H. <jdh...@ac...> - 2003年11月21日 23:31:46
>>>>> "John" == John Wohlbier <jd...@go...> writes:
 John> Am I doing something wrong? I guess I'll go back to version
 John> 0.32 for a while.
No, it appears your CVS mirror is behind. This happens all the time.
Here is a snapshot
 http://nitace.bsd.uchicago.edu:8080/files/share/matplotlib-0.40g.tar.gz
 John> By the way, when I run the python setup.py install command
 John> will the script properly overwrite the existing version of
 John> the matplotlib library, or should I go in and delete the old
 John> library first?
The installer will overwrite files but will not delete files that are
no longer used. There is no harm in deleting the old library and it
might do some good.
 John> Thanks!
No problem ...
JDH
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /