[Matplotlib-users] Removing a data series

2006-11-09 Thread Dan Karipides








I
did my best to search the examples, mailing list, etc. but was surprised that I
didnt even find this question asked, let alone answered.



My
basic question: Is it possible to remove a data series from a matplotlib plot?



Longer
question:



I'm
using matplotlib to generate graph images for an interactive web site. Through
the web site, the user can create a plot and add data series to it. I'd also
like the user to be able to remove a data series. At the moment, I am
accomplishing this by clearing the plot and replotting all the data series
except of course for the one to be removed. This seems inefficient.



So
something like:



 fig
= Figure()

 

 ax
= fig.add_subplot(111)



 series1
= ax.plot(some plot parameters here)

 series2
= ax.plot(some plot parameters here)

 series3
= ax.plot(some plot parameters here)



And
now I want to remove series2 from the plot.



Is
this possible? If it is, can anyone point me to the relevant part of the
user's guide/class library? Or is the best approach to clear the plot and
replot 1 and 3 (and reset all the axes, legends, etc.)



I
apologize if this is a FAQ, but as I said, my search for it came up empty.



Thanks,



-Dan

--

[EMAIL PROTECTED]








-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Removing a data series

2006-11-09 Thread Fernando Perez
Hi Dan,

On 11/9/06, Dan Karipides [EMAIL PROTECTED] wrote:

 I did my best to search the examples, mailing list, etc. but was surprised
 that I didn't even find this question asked, let alone answered.

Coincidentally it was asked just yesterday by Andrea Gavana, but you
may have missed it in your search (it may have crossed with your
posting time).

 My basic question: Is it possible to remove a data series from a matplotlib
 plot?

Here is a little self-contained example you can try (N==numpy, P=pylab):

In [24]: x = N.arange(10)

In [25]: fig = P.figure()

In [26]: ax = fig.add_subplot(111)

In [27]: ax.plot(x)
Out[27]: [matplotlib.lines.Line2D instance at 0x427ce7ec]

In [28]: ax.plot(x+10)
Out[28]: [matplotlib.lines.Line2D instance at 0x427ce88c]

In [29]: ax.plot(x+20)
Out[29]: [matplotlib.lines.Line2D instance at 0x427ce9ac]

In [30]: P.show()

In [31]: ax.lines
Out[31]:
[matplotlib.lines.Line2D instance at 0x427ce7ec,
 matplotlib.lines.Line2D instance at 0x427ce88c,
 matplotlib.lines.Line2D instance at 0x427ce9ac]

In [32]: del ax.lines[1]

In [33]: P.show()


This makes the middle line disappear from the plot.

Regards,

f

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Alpha and colorbar using contourf

2006-11-09 Thread Tom Denniston
When I use contourf with an alpha argument and the hot color scheme. The alpha causes the colors to come out lighter but the colorbar does not adjust accordingly. Is this a bug or do I simply need to adjust the colorbar in some manner?




Below is an adaptation of pcolor.py from the screenshots page and attached is the output I see.

I am using matplotlib 0.87.7:

In [3]: matplotlib.__version__Out[3]: '0.87.7'
--



from __future__ import divisionfrom pylab import *
def func3(x,y): return (1- x/2 + x**5 + y**3)*exp(-x**2-y**2)
dx, dy = 0.025, 0.025x = arange(-3.0, 3.0, dx)y = arange(-3.0, 3.0, dy)X,Y = meshgrid(x, y)
Z = func3(X, Y)
cset = contourf(Z, arange(-1.2,1.6,0.5), origin='lower', extent=(-3,3,-3,3), alpha=.5 )
axis('off')hot()colorbar()title('Some like it hot')show('example')


example.png
Description: PNG image
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Any fix for wxAgg on Mac?

2006-11-09 Thread Russell E Owen
At 10:18 AM -0800 2006-11-09, Christopher Barker wrote:
Russell and Charlie,

Are your two binaries any different? Any reason to choose one over 
the other? In particular, which of these are supported:

numpy 1.*
Numeric
numarray

GTK
TK
wx (which version?)

My binary supports:
- numpy 1.0 (the default), Numeric and numarray
- TkAgg using the built in Tcl/Tk or a user-added Tcl/Tk 8.4.x
- WXAgg using wxPython 2.6
   (I just realized this is the default, which is bad because it's not built in)

It does not support GTK or Qt.

Unfortunately it requires the user to:
- Install one or more numeric packages
- Set up a matploblibrc file unless they want to use numpy and WXAgg
so it includes a ReadMe.txt file telling the user what to do.

It would be better if matplotlib just ran out of the box. I'm not 
sure the best way to do this. Some possibilities are:
- Include numpy in the matplotlib package and have the default 
matplotlibrc file use that. One would have to be careful about how to 
handle an existing numpy (if any), and I really don't know how to do 
that. Naive users would probably appreciate matplotlib using its own 
version and ignoring any built in (and possibly incompatible) 
version, but that sounds like a nightmare for more experienced users.

- Run a post-install script that modifies the default matploblibrc 
file by looking for installed numeric packages and picking one as the 
default for numerix. It could warn the user if no compatible numeric 
package was found. This is clearly less friendly than the first 
option, but doesn't bring up the issue of conflicting with a 
user-installed numpy.

- Some combination whereby a post-install script installs numpy 1.0 
if no numpy is found and bitches loudly if a too-old version is found.

Any ideas on this? Charlie: does your version already handle this somehow?


If we use my package then I should submit a new version that has 
TkAgg as its default.

-- Russell

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Alpha and colorbar using contourf

2006-11-09 Thread Tom Denniston
Thanks Eric.
On 11/9/06, Eric Firing [EMAIL PROTECTED] wrote:
Tom,This is a bug.It looks like I completely forgot about handling alphawhen I rewrote the colorbar code.I will try to get it fixed in the
next few days.Thanks for the report.EricTom Denniston wrote: When I use contourf with an alpha argument and the hot color scheme. The alpha causes the colors to come out lighter but the colorbar does
 not adjust accordingly.Is this a bug or do I simply need to adjust the colorbar in some manner? Below is an adaptation of pcolor.py from the screenshots page and attached is the output I see.
 I am using matplotlib 0.87.7: In [3]: matplotlib.__version__ Out[3]: '0.87.7'--
 from __future__ import division from pylab import * def func3(x,y): return (1- x/2 + x**5 + y**3)*exp(-x**2-y**2) dx, dy = 0.025, 0.025 x = arange(-3.0, 3.0
, dx) y = arange(-3.0, 3.0, dy) X,Y = meshgrid(x, y) Z = func3(X, Y) cset = contourf(Z, arange(-1.2,1.6,0.5),origin='lower',extent=(-3,3,-3,3), alpha=.5
) axis('off') hot() colorbar() title('Some like it hot') show('example') 
  - Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo 
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642  ___
 Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/matplotlib-users-Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Any fix for wxAgg on Mac?

2006-11-09 Thread Charlie Moad
On 11/9/06, Russell E Owen [EMAIL PROTECTED] wrote:
 At 10:18 AM -0800 2006-11-09, Christopher Barker wrote:
 Russell and Charlie,
 
 Are your two binaries any different? Any reason to choose one over
 the other? In particular, which of these are supported:
 
 numpy 1.*
 Numeric
 numarray
 
 GTK
 TK
 wx (which version?)

 My binary supports:
 - numpy 1.0 (the default), Numeric and numarray
 - TkAgg using the built in Tcl/Tk or a user-added Tcl/Tk 8.4.x
 - WXAgg using wxPython 2.6
   (I just realized this is the default, which is bad because it's not built 
 in)

 It does not support GTK or Qt.

 Unfortunately it requires the user to:
 - Install one or more numeric packages
 - Set up a matploblibrc file unless they want to use numpy and WXAgg
 so it includes a ReadMe.txt file telling the user what to do.

 It would be better if matplotlib just ran out of the box. I'm not
 sure the best way to do this. Some possibilities are:
 - Include numpy in the matplotlib package and have the default
 matplotlibrc file use that. One would have to be careful about how to
 handle an existing numpy (if any), and I really don't know how to do
 that. Naive users would probably appreciate matplotlib using its own
 version and ignoring any built in (and possibly incompatible)
 version, but that sounds like a nightmare for more experienced users.

 - Run a post-install script that modifies the default matploblibrc
 file by looking for installed numeric packages and picking one as the
 default for numerix. It could warn the user if no compatible numeric
 package was found. This is clearly less friendly than the first
 option, but doesn't bring up the issue of conflicting with a
 user-installed numpy.

 - Some combination whereby a post-install script installs numpy 1.0
 if no numpy is found and bitches loudly if a too-old version is found.

 Any ideas on this? Charlie: does your version already handle this somehow?


 If we use my package then I should submit a new version that has
 TkAgg as its default.

I am guessing our versions are pretty much the same.  All the latest
numerical modules, no gtk, etc.  I don't think we need to worry about
dependencies.  Windows and linux doesn't technically run out of the
box either.  They are required to get the correct deps.

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Any fix for wxAgg on Mac?

2006-11-09 Thread Christopher Barker
Russell and Charlie,

Are your two binaries any different? Any reason to choose one over the 
other? In particular, which of these are supported:

numpy 1.*
Numeric
numarray

GTK
TK
wx (which version?)

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

NOAA/ORR/HAZMAT (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Removing a data series

2006-11-09 Thread Angus McMorland
On 10/11/06, Dan Karipides [EMAIL PROTECTED] wrote:
 Fernando,

 Thanks, this is exactly what I need.

 BTW, I think I missed it in the search because the archive here:

 http://sourceforge.net/mailarchive/forum.php?forum_id=33405

 doesn't show anything more recent that 10/02/2006.  I'm not sure why this
 is.

 Thanks again,

 -Dan
 -
 [EMAIL PROTECTED]


Since this is the third time I've seen this question pop up in a  few
months, I've put an entry in the wiki for it here
(http://www.scipy.org/Cookbook/Matplotlib/DeletingAnExistingDataSeries).
Fernando, I hope you don't mind me using your example on the page - it
seemed the most thorough.

A.
-- 
AJC McMorland, PhD Student
Physiology, University of Auckland

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Removing a line from a plot

2006-11-09 Thread Andrea Gavana
Thank you guys, and thanks for the Wiki entry ;-)

Andrea.

On 11/9/06, Pierre GM [EMAIL PROTECTED] wrote:

  I have a GUI written in wxPython, the main portion of it is a
  matplotlib canvas. There is a tree control on the left with
  checkboxes: if the user checks a checkbox, I add a line on the plot.
  So far so good. The problem comes when the user *un-checks* the
  checkbox. I would like to remove the line from the plot, but the only
  way I found to do it is to do:

 To suppress the last line drawn:
 del(gca().lines[-1])

 (replace gca() by the handle of the subplot you're acting on)

 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



-- 
Andrea.

Imagination Is The Only Weapon In The War Against Reality.
http://xoomer.virgilio.it/infinity77/

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Removing a line from a plot

2006-11-09 Thread John Hunter
 Andrea == Andrea Gavana [EMAIL PROTECTED] writes:

Andrea Thank you guys, and thanks for the Wiki entry ;-) Andrea.

Since ax.lines is just a list, you can also use the remove method

  line1, = ax.plot(something)
  line2, = ax.plot(somethingelse)
  line3, line4 = ax.plot(x3, y3, x4, y4)

  ax.lines.remove(line3)

JDH

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to build matplotlib with wx support

2006-11-09 Thread Christopher Barker
Russell E Owen wrote:
 There are two issues:
 1) The wxPython installer is finding the wrong wx-config. It finds 
 the one for the outdated built-in wx instead of the one used by 
 wxPython (which is deeply buried and very unlikely to be on your 
 $PATH).
 2) There are bugs in the particular wxPython 2.7 I was using that 
 prevent building matplotlib. Note that 2.7.x is, by definition, a 
 development branch; the next stable release series will be 2.8.x.

I'm not sure if it's a bug in wxPython 2.7 -- or a bug in the wxAgg code 
that happens to be triggered by 2.7...

 - Put its wx-config on your path. I did this as follows:
 sudo ln -s 
 /usr/local/lib/wxPython-unicode-2.6.3.3/lib/wx/config/mac-unicode-debug-2.6

The other option is to set an environment variable, before running setup.py:
(bash syntax)

export WX_CONFIG=/usr/local/lib/wxPython-unicode-2.6.3.3/bin/wx-config


-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

NOAA/ORR/HAZMAT (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Removing a line from a plot

2006-11-09 Thread Fernando Perez
On 11/9/06, John Hunter [EMAIL PROTECTED] wrote:
  Andrea == Andrea Gavana [EMAIL PROTECTED] writes:

 Andrea Thank you guys, and thanks for the Wiki entry ;-) Andrea.

 Since ax.lines is just a list, you can also use the remove method

   line1, = ax.plot(something)
   line2, = ax.plot(somethingelse)
   line3, line4 = ax.plot(x3, y3, x4, y4)

   ax.lines.remove(line3)

With the caveat that I think this is O(N) in the length of the list,
with comparison operations at each step.  I think 'del alist[i]' is
also O(N), but amortized and with  *much* smaller constant (only cheap
internal pointer shuffling, without any real Python work).

Someone with better knowledge of the list object internals, feel free
to correct the above (I'm actually curious if the reality is
different).

Cheers,

f

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] New to matplotlib; documentation errors

2006-11-09 Thread Simson Garfinkel
I'm new to matplotlib; I was using PyX but matplotlib seems further  
developed for what I want to do.

One of the problems that I'm having is simply getting started. I've  
discovered that there are a whole bunch of dependencies that weren't  
obvious in the manual:

* You need PyNum (documented)
* You need wxPython (not documented that I've found)

Nevertheless, I'm still having problems. The example in the beginning  
of the manual doesn't work for me; array() is undefined:

% python
Python 2.4.3 (#1, Mar 30 2006, 11:02:16)
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
Type help, copyright, credits or license for more information.
  from pylab import *
  dt = 0.01
  t = arrange(0,10,dt)
Traceback (most recent call last):
   File stdin, line 1, in ?
NameError: name 'arrange' is not defined
 

I'm using a MacOS machine running 10.4.

Any suggestions?





-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Any fix for wxAgg on Mac?

2006-11-09 Thread Christopher Barker
Russell E Owen wrote:
 It turns out my wx-config was in:
 /usr/local/lib/wxPython-unicode-2.7.1.3/lib/wx/config/mac-unicode-debug-2.7
 not a location I'd ever have expected or would want to add to my $PATH 
 (and not easy to find -- I had to use a special file finding utility to 
 find it).
 
 No wonder I was having problems!
 
 Do you know who produced the wxPython installer package?

Robin Dunn builds those himself.

 If so, please 
 tell me or feel free to forward this message (edited as you see fit). I 
 want to suggest they put links to binaries in one of:
 - /usr/local/bin
 - /Library/Frameworks/Python.../bin
 
 I think the former is the right choice if the associated wx C++ 
 libraries (as installed by wxPython) are accessible to C++ users. 

They are really intended to be used specifically by wxPython. Often they 
are slightly different versions. I now when I've used wx for C++, I've 
used different libs.

 Otherwise if it's really a python-private sort of thing then it should 
 probably be the latter.

I think so. But there is a problem there, too. As I mentioned, you can 
have different versions of wxPython installed at once, so which one 
would put it's wx-config there?

Also, /Library/Frameworks/Python.../bin is the default locations for 
binaries on OS-X, set by dist-utils. On other systems, it's set to 
/usr/local, or who knows? In that case, putting wx-config there could 
clash with both C++ wx installations, and wxPythons used for different 
versions of python -- there's just no easy way. At least this way, when 
you pick that wx-config, you KNOW you've got the one you want.

As far as MPL is concerned, we could write a little code that would 
search for the default wxPython, and find wx-config there.

However, the better solution is really to get rid of the compile-time 
dependence on wx -- that's a problem anyway. For instance, I'm not sure 
we should make the pythonmac binary depend on wxPython 2.7 -- that is a 
development version -- 2.6.3 may be a better choice.

If only we all didn't have other things to do...

-Chris




-- 
Christopher Barker, Ph.D.
Oceanographer

NOAA/ORR/HAZMAT (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Any fix for wxAgg on Mac?

2006-11-09 Thread Christopher Barker
Russell E. Owen wrote:
 I reinstalled wxPython 2.7 from the package at pythonmac.org (to be 
 paranoid). I'm using the Python 2.5 version.

check

 I got wx-config on my path and confirmed it's the right one (see below 
 for details).

check.

 Now when I try to build matplotlib it fails. Ouch.
 
 It starts out with the same warning as last time:
 setup.py:267: DeprecationWarning: The wxPython compatibility package is 
 no longer automatically generated or activly maintained.  Please switch 
 to the wx package as soon as possible.
   import wxPython

This one is easy!

In setup.py, replace:

import wxPython

with

import wx

A few versions ago, the import wxPython form was deprecated -- it is 
now gone in 2.7. IN this case, all it's doing it checking if wxPython is 
installed, so th import wx should be the only change needed.

A quick search revealed that the back-end itself has been switched over 
already.

-Chris

PS: you haven't been sending your notes to the list.

-- 
Christopher Barker, Ph.D.
Oceanographer

NOAA/ORR/HAZMAT (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] x and ylabel problem when embedding in wx

2006-11-09 Thread Emmanuel Favre-Nicolin
I have problem with xlabel and ylabel when embedding in wx. See snapshot :
http://emmanuelfavrenicolin.free.fr/Public/Divers/Snapshots1/wx_snap.png
I put a test code which is based on dynamic_demo_wx.py, adding only the 3 
lines :
a.set_title('Title')
a.set_xlabel('Xaxis [u.a.]')
a.set_ylabel('Yaxis [u.a.]')
Just to add title, and label. In this case Ylabel is superposed on ytics 
labels and xlabel is hidden by the navigation toolbar.

Do I need twiking and/or understand better wxpython ? 
Anyone can help me?

sample code :

import matplotlib
matplotlib.use('WX')
from matplotlib.backends.backend_wx import FigureCanvasWx,\
 FigureManager, NavigationToolbar2Wx

from matplotlib.figure import Figure
from matplotlib.axes import Subplot
import matplotlib.numerix as numpy
from wxPython.wx import *

TIMER_ID = wxNewId()

class PlotFigure(wxFrame):

def __init__(self):
wxFrame.__init__(self, None, -1, Test embedded wxFigure)

self.fig = Figure((6,4), 75)
self.canvas = FigureCanvasWx(self, -1, self.fig)
self.toolbar = NavigationToolbar2Wx(self.canvas)
self.toolbar.Realize()

# On Windows, default frame size behaviour is incorrect
# you don't need this under Linux
tw, th = self.toolbar.GetSizeTuple()
fw, fh = self.canvas.GetSizeTuple()
self.toolbar.SetSize(wxSize(fw, th))

# Create a figure manager to manage things
self.figmgr = FigureManager(self.canvas, 1, self)
# Now put all into a sizer
sizer = wxBoxSizer(wxVERTICAL)
# This way of adding to sizer allows resizing
sizer.Add(self.canvas, 1, wxLEFT|wxTOP|wxGROW)
# Best to allow the toolbar to resize!
sizer.Add(self.toolbar, 0, wxGROW)
self.SetSizer(sizer)
self.Fit()
EVT_TIMER(self, TIMER_ID, self.onTimer)

def init_plot_data(self):
a = self.fig.add_subplot(111)
a.set_title('Title')
a.set_xlabel('Xaxis [u.a.]')
a.set_ylabel('Yaxis [u.a.]')
self.ind = numpy.arange(60)
tmp = []
for i in range(60):
tmp.append(numpy.sin((self.ind+i)*numpy.pi/15))
self.X = numpy.array(tmp)
self.lines = a.plot(self.X[:,0],'o')
self.count = 0

def GetToolBar(self):
# You will need to override GetToolBar if you are using an 
# unmanaged toolbar in your frame
return self.toolbar

def onTimer(self, evt):
self.count += 1
if self.count = 60: self.count = 0
self.lines[0].set_data(self.ind, self.X[:,self.count])
self.canvas.draw()
self.canvas.gui_repaint()

if __name__ == '__main__':
app = wxPySimpleApp()
frame = PlotFigure()
frame.init_plot_data()

# Initialise the timer - wxPython requires this to be connected to the
# receivicng event handler
t = wxTimer(frame, TIMER_ID)
t.Start(100)

frame.Show()
app.MainLoop()

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Any fix for wxAgg on Mac?

2006-11-09 Thread Christopher Barker
Russell E Owen wrote:
 I should probably be using wxPython 2.6.x. I originally thought wxPython 
 2.7 was the current release but as you pointed out, that was a 
 misconception. Unfortunately, it's the only binary package available for 
 Python 2.5 at pythonmac.org.

There is a binary of wxPython 2.6 for Python2.5 at:

http://www.wxpython.org/download-2.6.3.3.php

Maybe I'll ask Bob to put that up on pythonmac -- the 2.7 one is out of 
date already anyway. Let me know how it works.

-CHB


-- 
Christopher Barker, Ph.D.
Oceanographer

NOAA/ORR/HAZMAT (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] x and ylabel problem when embedding in wx

2006-11-09 Thread Emmanuel Favre-Nicolin
Hi,

(I'm sending again because email was probably filtered?)

I have problem with xlabel and ylabel when embedding in wx. See snapshot :
http://emmanuelfavrenicolin.free.fr/Public/Divers/Snapshots1/wx_snap.png
I put a test code which is based on dynamic_demo_wx.py, adding only the 3 
lines :
a.set_title('Title')
a.set_xlabel('Xaxis [u.a.]')
a.set_ylabel('Yaxis [u.a.]')
Just to add title, and label. In this case Ylabel is superposed on ytics 
labels and xlabel is hidden by the navigation toolbar.

Do I need twiking and/or understand better wxpython ? 
Anyone can help me?

sample code :

import matplotlib
matplotlib.use('WX')
from matplotlib.backends.backend_wx import FigureCanvasWx,\
 FigureManager, NavigationToolbar2Wx

from matplotlib.figure import Figure
from matplotlib.axes import Subplot
import matplotlib.numerix as numpy
from wxPython.wx import *

TIMER_ID = wxNewId()

class PlotFigure(wxFrame):

def __init__(self):
wxFrame.__init__(self, None, -1, Test embedded wxFigure)

self.fig = Figure((6,4), 75)
self.canvas = FigureCanvasWx(self, -1, self.fig)
self.toolbar = NavigationToolbar2Wx(self.canvas)
self.toolbar.Realize()

# On Windows, default frame size behaviour is incorrect
# you don't need this under Linux
tw, th = self.toolbar.GetSizeTuple()
fw, fh = self.canvas.GetSizeTuple()
self.toolbar.SetSize(wxSize(fw, th))

# Create a figure manager to manage things
self.figmgr = FigureManager(self.canvas, 1, self)
# Now put all into a sizer
sizer = wxBoxSizer(wxVERTICAL)
# This way of adding to sizer allows resizing
sizer.Add(self.canvas, 1, wxLEFT|wxTOP|wxGROW)
# Best to allow the toolbar to resize!
sizer.Add(self.toolbar, 0, wxGROW)
self.SetSizer(sizer)
self.Fit()
EVT_TIMER(self, TIMER_ID, self.onTimer)

def init_plot_data(self):
a = self.fig.add_subplot(111)
a.set_title('Title')
a.set_xlabel('Xaxis [u.a.]')
a.set_ylabel('Yaxis [u.a.]')
self.ind = numpy.arange(60)
tmp = []
for i in range(60):
tmp.append(numpy.sin((self.ind+i)*numpy.pi/15))
self.X = numpy.array(tmp)
self.lines = a.plot(self.X[:,0],'o')
self.count = 0

def GetToolBar(self):
# You will need to override GetToolBar if you are using an 
# unmanaged toolbar in your frame
return self.toolbar

def onTimer(self, evt):
self.count += 1
if self.count = 60: self.count = 0
self.lines[0].set_data(self.ind, self.X[:,self.count])
self.canvas.draw()
self.canvas.gui_repaint()

if __name__ == '__main__':
app = wxPySimpleApp()
frame = PlotFigure()
frame.init_plot_data()

# Initialise the timer - wxPython requires this to be connected to the
# receivicng event handler
t = wxTimer(frame, TIMER_ID)
t.Start(100)

frame.Show()
app.MainLoop()

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] x and ylabel problem when embedding in wx

2006-11-09 Thread John Hunter
 John == John Hunter [EMAIL PROTECTED] writes:

John It's not about wx or wxpython, it's a matplotlib issue.

Let me add some color to that statement -- when I took a look at your
screenshot, I realized you are using the WX backend and not the WXAgg
backend.  If you don't understand the difference, peruse
http://matplotlib.sf.net/backends.html .  WXAgg may have the same
problem (and the same solution from my last post) but will give you
more consistent rendering and layout.

JDH

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users