Re: [Matplotlib-users] ANN: matplotlib-0.90.0

2007-02-07 Thread Werner F. Bruhin
Hi Charlie,

Great to see a new release, will put some time aside to test it with 
wxPython early next week.

I can't see a reference to the wxPython backend, will it still require 
the Unicode build or can one use the Ansi build and which versions of 
wxPython are supported?

Werner

-
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] basemap conversion to Google Earth?

2007-02-07 Thread Mark Bakker

Hello -

Can basemap help with a coversion to Google Earth coordinates and mabye even
a kmz file?

Thanks, Mark
-
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] basemap conversion to Google Earth?

2007-02-07 Thread Jeff Whitaker
Mark Bakker wrote:
 Hello -

 Can basemap help with a coversion to Google Earth coordinates and 
 mabye even a kmz file?

 Thanks, Mark

Mark:  AFAICT, google earth uses geographic coordinates (just plain lat 
and lon, with no map projection).  Basemap could help if you have data 
on a map projection grid, and you want to convert it to lat/lon.

KML/KMZ is just a file format that Google Earth uses to store 
information, such as  placemarks, descriptions, ground overlays, paths, 
and polygons.  Basemap doesn't have any ability to read or write these 
files, but contributions are always welcome.

-Jeff

-- 
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC  R/PSD1FAX   : (303)497-6449
325 BroadwayBoulder, CO, USA 80305-3328


-
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] Notes on switching backends to qt4 on mac os x

2007-02-07 Thread Rob Hetland

Here are some notes I made -- I hope it might save someone a bit of  
time.

So, I finally tried out a few other backends on mac os x.  I had been  
recommending and using TkAgg, as this works out of the box on mac os  
x.  However, it seems unsnappy sometimes, and there was this strange  
issue with the first window not giving control back to the command line.

QT4 takes *forever* to compile, but it seems to compile easier now  
than previous versions that needed a small library hack.  The default  
configuration compiles and installs fine.  The other tools (PyQt4 and  
SIP) also compile and install painlessly with the default configuration.

I initially forgot to set the -q4thread for ipython (since the other - 
pylab flag is hidden in a launching script).  After that it worked  
mostly fine.

I found that the correct  threading was sensitive to how I started  
ipython.  I have been using terminal, and I was starting ipython like  
this:

bash -l -c /path/to/ipython -q4thread

from within a terminal .term file (i.e., the terminal starts running  
ipython automatically).  This seems to not work great.  However, when  
I put this command in a script, and run the script like

bash -l -c pylab_start_script

thinks work as expected.  This is also true when just typing these  
commands in on the command line.   I almost always start ipython from  
a terminal .term file from quicksilver.  This gives me a dedicated  
(color coded) ipython window instantly that does not take away my  
shell.  This is all pretty slick, and I am pleased with the setup now.

Developers:  Finally, I had to make some small changes to the qt4  
backend so that things worked right.  One is an essential change --  
the latin1() method no longer exists in the newer qt.  The other is a  
cosmetic change so that I can see the cursor position in the toolbar  
better.  Diff below.

-Rob



Index: backend_qt4.py
===
--- backend_qt4.py  (revision 2999)
+++ backend_qt4.py  (working copy)
@@ -148,7 +148,7 @@
  def _get_key( self, event ):
  if event.key()  256:
-key = event.text().latin1()
+key = str(event.text())
  elif self.keyvald.has_key( event.key() ):
  key = self.keyvald[ event.key() ]
  else:
@@ -290,7 +290,7 @@
  # The automatic layout doesn't look that good - it's  
too close
  # to the images so add a margin around it.
-margin = 4
+margin = 12
  button.setFixedSize( image.width()+margin, image.height 
()+margin )
  QtCore.QObject.connect( button, QtCore.SIGNAL( 'clicked 
()' ),
@@ -301,7 +301,7 @@
  # The stretch factor is 1 which means any resizing of the  
toolbar
  # will resize this label instead of the buttons.
  self.locLabel = QtGui.QLabel( , self )
-self.locLabel.setAlignment( QtCore.Qt.AlignRight |  
QtCore.Qt.AlignVCenter )
+self.locLabel.setAlignment( QtCore.Qt.AlignRight |  
QtCore.Qt.AlignTop )
  self.locLabel.setSizePolicy(QtGui.QSizePolicy 
(QtGui.QSizePolicy.Ignored,
 
QtGui.QSizePolicy.Ignored))
  self.layout.addWidget( self.locLabel, 1 )



Rob Hetland, Associate Professor
Dept. of Oceanography, Texas AM University
http://pong.tamu.edu/~rob
phone: 979-458-0096, fax: 979-845-6331



-
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] ANN: matplotlib-0.90.0

2007-02-07 Thread Charlie Moad
On 2/7/07, Werner F. Bruhin [EMAIL PROTECTED] wrote:
 Charlie,

 Charlie Moad wrote:
  On 2/7/07, Werner F. Bruhin [EMAIL PROTECTED] wrote:
  Hi Charlie,
 
  Great to see a new release, will put some time aside to test it with
  wxPython early next week.
 
  I can't see a reference to the wxPython backend, will it still require
  the Unicode build or can one use the Ansi build and which versions of
  wxPython are supported?
 
  Well, we haven't built any binaries yet.  We pushed a source release
  fast to try to get it into Feisty.  Sorry Chris!  With wx2.8 out now
  and this being a major release, we definitely need to rethink wx
  builds.  We stuck with unicode for 0.87 to avoid confusion.  I would
  be happy to hear what wx users think/want.
 For me the ideal would be not to be depended on a particular release of
 wxPython - big surprise no :-) .

 If I understand it correctly the dependency came in for performance
 optimization, does 2.8 change something for this.

 - If yes, I would not see a problem with 0.9 requiring as a minimum
 2.8.0.1 but going forward I could use any 2.8.x or newer release.
 - If no, then I guess we have to live with having a fixed dependency,
 e.g. 0.87 is wxPython 2.6.x, 0.90 is wxPython 2.8.x, but it should
 through at least a warning if one tries to use it with another wxPython
 release.

A while back there was some talk on the dev list about a pure python
blitting method.  I believe 2.8 had features that made this possible.
I don't think anyone actually implemented this though.  I'll have to
check if the current native wx code even compiles with 2.8.  The
pure-python wx interface is still there and works but doesn't allow
for efficient blitting.

-
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] Trying

2007-02-07 Thread Michael Lerner
That works for me.  Thanks.  I was trying to muck around with _lut
directly and make a sentinel version of LinearSegmentedColormap.  As I
didn't really know what I was doing, I was having some strange
results.  Also, in case other folks don't realize this, you can
initialize this with a Colormap, LinearSegmentedColormap,  etc.

I'd be happy to update the SciPy wiki.  Is it customary to give credit
to various authors (obviously George Nurser and the original author,
not me) in the doc strings, wiki text or what?

Thanks,

-michael

On 2/6/07, George Nurser [EMAIL PROTECTED] wrote:
 On 05/02/07, John Hunter [EMAIL PROTECTED] wrote:
  On 2/5/07, Michael Lerner [EMAIL PROTECTED] wrote:
   Hi,
  
   I have some data where I'd like almost all of it to be plotted with a
   LinearSegmentedColormap that I've made, but I have a few special
   values that I'd like to set to specific colors (white, in this case).
   So, I made a LinearSegmentedColormap that works pretty well, but I'm
   having trouble with the rest.  I found a nice-looking example at
  
   http://www.scipy.org/Cookbook/Matplotlib/Plotting_Images_with_Special_Values
  
   But, it doesn't work for me.  In particular, it complains a lot about
   _lut.  I'm using matplotlib 0.87.7 on an intel Mac running OS X and
   python 2.4.
 
  On a very quick read, it appears that the sentinel map in that example
  forgot to initialize the baseclass.  Eg, you need
 
   class SentinelMap(Colormap):
   def __init__(self, cmap, sentinels={}):
   Colormap.__init__(self)  # init the base class
   # boilerplate stuff - rest of init function here
 
  See if that helps, and let us know.  If you get it working, please fix
  the wiki (you may have to sign up) and post your example along with
  it.
 
  Otherwise, please post a complete code example and we'll see what we can do.
 
  JDH
 
 
  
   Can someone show me how to make a sentinel'd version of a
   LinearSegmentedColormap?
  
   Thank you,
  
   -Michael Lerner

 I had the same problem that you did with the sentinels.py.

 I modified the code so that it did work, and attach it here. you can
 test it by running it.  It only works with numpy, because it uses
 fancy indexing. I'm pretty sure it's not done the fastest  way.

 You first make up the colormap instance for the real data, without any
 sentinels.
 then use the colormap instance as an argument to the sentinel
 colormap. This is why it
 doesn't do a  Colormap.__init__(self). Not sure that's really best,
 but i just followed the original method.

 HTH. George Nurser.




-- 
Biophysics Graduate Student
Carlson Lab, University of Michigan
http://www.umich.edu/~mlerner http://lernerclan.net

-
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] Native file format

2007-02-07 Thread John Hunter
On 2/7/07, Edin Salkovic [EMAIL PROTECTED] wrote:

 Why can't mpl's figures be pickled?

The main thing is we need to add pickle support for all of mpl's extension code

  http://docs.python.org/lib/node321.html

In earlier attempts people got stuck with trying to pickle the
CXX extension code, which was causing some problems, but these
problems may be fixed in more recent versions of CXX.  Todd Miller was
the last person to look at this in some detail, I think.

Other hinderances may come from the GUI layer, since figures store
pointers to their canvases which in some cases come from GUI extension
code that may not support pickling.  But we can fairly easy decouple
the figure from the canvas at pickle time and deal with pure mpl,
numpy and python objects.  The main work is to add pickle
serialization to the mpl extension code.

-
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] Native file format

2007-02-07 Thread Todd Miller
Perry Greenfield wrote:
 On Feb 7, 2007, at 10:21 AM, John Hunter wrote:

   
 On 2/7/07, Edin Salkovic [EMAIL PROTECTED] wrote:

 
 Why can't mpl's figures be pickled?
   
 The main thing is we need to add pickle support for all of mpl's  
 extension code

   http://docs.python.org/lib/node321.html

 In earlier attempts people got stuck with trying to pickle the
 CXX extension code, which was causing some problems, but these
 problems may be fixed in more recent versions of CXX.  Todd Miller was
 the last person to look at this in some detail, I think.

 
 I think Todd did get it to work, but I'll copy him on this just to make
 sure.
   
I looked at this in the context of numarray session saving and 
restoring.   In that context,  I believed there was a general problem 
with extension types not being picklable as a matter of developer 
expediency:  first order,  pickling support often doesn't get done.   So 
my approach was to fudge a little and create proxy objects for things 
which wouldn't pickle  rather than fix all extension types.   Where I 
left off CXX still didn't support pickling but a Python session with 
matplotlib and numarray could be saved;  numarray arrays would be 
preserved,  matplotlib objects would be proxied but unfortunately the 
proxies don't work in that case.

Todd
 Other hinderances may come from the GUI layer, since figures store
 pointers to their canvases which in some cases come from GUI extension
 code that may not support pickling.  But we can fairly easy decouple
 the figure from the canvas at pickle time and deal with pure mpl,
 numpy and python objects.  The main work is to add pickle
 serialization to the mpl extension code.

 -- 
 ---
 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 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 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] [matplotlib-devel] Notes on switching backends to qt4 on mac os x

2007-02-07 Thread Christopher Barker
Rob Hetland wrote:
 The MPL Qt backend requires PyQt (or, better, Qt4 and PyQt4).  PyQt does 
 compile against the Qt Library, and also takes quite a while to 
 complete.

I guess I wasn't clear -- does the MPL QT back-end compile against QT? 
Or can you just install PyQt after MPL, and have it work?

I'm on a quest to get as complete as possible a MPL binary for OS-X, so 
I need to know if I need to have PyQt all working to build an MPL binary 
that supports it.

   PyQt does not use setuptools, and I am not sure how to make a
 generally usable binary distribution from it.

Does it build with distutils? If so, then, in theory, you can use 
bdist_mpkg to build a binary package. bdist_mpkg comes with Py2app.

I say in theory because PyQt is pretty complex, so it may not s work 
out of the box. However, there was some work done a while back adapting 
py2app to support it, so it just may work. If it doesn't the folks on 
pythonmac list can probably help.

 I would say that installation is quite easy (although time consuming) -- 
 perhaps just a good set of directions on the MPL site?

That would certainly be a start -- though shouldn't such directions be 
on a QT or MacPython site. The pythonmac Wiki has had troubles lately, 
I'm afraid, though it seems to be up at the moment:

http://www.pythonmac.org/wiki

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(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] ANN: matplotlib-0.90.0

2007-02-07 Thread Christopher Barker
Werner F. Bruhin wrote:
 Great to see a new release, will put some time aside to test it with 
 wxPython early next week.

looking forward to your reports.

 which versions of wxPython are supported?

I haven't tried the new one, but the last release worked well with 
wxPython2.6.3, but had some issues with 2.8.* -- I don't think anyone 
has addressed those yet.

 Well, we haven't built any binaries yet.  We pushed a source release
 fast to try to get it into Feisty.  Sorry Chris!

well, I've been chattering on about this for awhile, but haven't 
contributed anything yet...

  With wx2.8 out now
 and this being a major release, we definitely need to rethink wx
 builds.  We stuck with unicode for 0.87 to avoid confusion.  I would
 be happy to hear what wx users think/want.

I think it's time to just all unicode, all the way, but I mostly deal 
with English anyway.

 For me the ideal would be not to be depended on a particular release of 
 wxPython - big surprise no :-)

That would be nice.

 If I understand it correctly the dependency came in for performance 
 optimization, does 2.8 change something for this.

Perhaps. 2.8 has methods for directly setting the data in wxBitmaps. 
Before that, you needed to create a wxImage, then convert that to a bitmap.

However, to do that right, you'd need to be able to get the Agg bitmap 
as a Python buffer object that is in the binary form required by the 
platform. I think the majors need RGB and/or RGBA, but I'm not totally 
sure about that (maybe OS-X is ARGB?)

 - If yes, I would not see a problem with 0.9 requiring as a minimum 
 2.8.0.1 but going forward I could use any 2.8.x or newer release.

That would be a good way to go, or have fallback on the older methods 
for less than 2.8 -- so instead of saying you need 2.8 to use the wx 
backend we can say: you'll get better performance with wx if you use  
2.8

 - If no, then I guess we have to live with having a fixed dependency, 
 e.g. 0.87 is wxPython 2.6.x, 0.90 is wxPython 2.8.x, but it should 
 through at least a warning if one tries to use it with another wxPython 
 release.

Yes, it should. I've also started a patch for the build system that 
tries harder to make sure that you are building against the same wx that 
you are running -- that will at least help people built it themselves 
more easily.

NOTE: I took a look at the wx backend code a while ago, and it looks 
like even without the new Bitmap handlers in 2.8, it could be faster 
with straight Python code. Key is that a wxImage can be created from a 
Python buffer object without copying the data. So if we can expose the 
Agg buffer as a Python buffer, as RGB, then we should be able to get 
decent performance with pure python. You'd still need to do the 
wxBitmapFromImage thing, but the accelerated back-end does that too.

Look for a thread on this list a while back, with my and Ken's name on it.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(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] Numpy image module failure

2007-02-07 Thread Koontz, Joshua (IMS)
I've just installed matplotlib on a 64 bit server running Suse Linux
Enterprise Server 9.  I followed the instructions on the Installing
section from the webpage and everything seemed to install fine using the
defaults.  I installed the latest version of Numpy, 1.0.1, then
proceeded to install matplotlib.  (I had the devel packages of freetype,
libpng, and zlib installed.)  I don't need a GUI Backend so I wasn't
worried about getting them installed properly.  Everything seems fine, I
can import numpy and matplotlib into python.  However, I run into this
problem when trying to do an import.  Here's the sample code:

#!/usr/bin/env python
import os
import tempfile
import matplotlib
matplotlib.use('Agg')  # force the antigrain backend
from matplotlib import rc
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.figure import Figure
from matplotlib.cbook import iterable
import matplotlib.numerix as nx

***snip***

And here is the output:

$ python test_matlib.py

The import of the numpy version of the _image module,
_ns_image, failed.  This is is either because numpy was
unavailable when matplotlib was compiled, because a dependency of
_ns_image could not be satisfied, or because the build flag for
this module was turned off in setup.py.  If it appears that
_ns_image was not built, make sure you have a working copy of
numpy and then re-install matplotlib. Otherwise, the following
traceback gives more details:

Traceback (most recent call last):
  File test_matlib.py, line 7, in ?
from matplotlib.backends.backend_agg import FigureCanvasAgg
  File
/usr/local/lib/python2.3/site-packages/matplotlib/backends/backend_agg.
py, line 77, in ?
from matplotlib._image import fromarray
  File /usr/local/lib/python2.3/site-packages/matplotlib/_image.py,
line 17, in ?
from matplotlib._ns_image import *
ImportError:
/usr/local/lib/python2.3/site-packages/matplotlib/_ns_image.so:
undefined symbol: _ZNSs4_Rep20_S_empty_rep_storageE

$


It seems like it's something very simple, but I can't seem to find what
went wrong.  Anybody have any ideas??

Thanks
Josh
 
 


Information in this e-mail may be confidential. It is intended only for the 
addressee(s) identified above. If you are not the addressee(s), or an employee 
or agent of the addressee(s), please note that any dissemination, distribution, 
or copying of this communication is strictly prohibited. If you have received 
this e-mail in error, please notify the sender of the error.

-
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] Trying

2007-02-07 Thread George Nurser
On 07/02/07, Michael Lerner [EMAIL PROTECTED] wrote:
 That works for me.  Thanks.  I was trying to muck around with _lut
 directly and make a sentinel version of LinearSegmentedColormap.  As I
 didn't really know what I was doing, I was having some strange
 results.  Also, in case other folks don't realize this, you can
 initialize this with a Colormap, LinearSegmentedColormap,  etc.

 I'd be happy to update the SciPy wiki.

Please do.

I believe the original code was written by Andrew Straw; at least he
put it up on the wiki.

A word of warning: because the code replaces various Normalize
methods, it's not guaranteed to work with future mpl releases.

It would be nice if something like this, but perhaps more efficient,
was included in matplotlib. It's a useful thing to be able to do.

Regards, George.

-
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] Problem with adding an artist from one axes instance to another

2007-02-07 Thread Berthold Höllmann
I try to take artists from one subplot instance and add them to
another:

-
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.patches import Patch, Rectangle
from matplotlib.lines import Line2D

fig = Figure()
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)
ax.add_patch(Rectangle((.5, 1.5), 1, .2))
fig2 = Figure()
canvas2 = FigureCanvas(fig2)
ax2 = fig2.add_subplot(111)
for artist in ax.get_child_artists():
if isinstance(artist, Line2D):
ax2.add_line(artist)
elif isinstance(artist, Patch):
ax2.add_patch(artist)

ax2.add_patch(Rectangle((1.5, 2.5), 1, .2, facecolor='r'))
ax2.set_aspect(equal)
ax2.autoscale_view()
w, h = fig2.get_size_inches()
xmin, xmax = ax2.get_xlim()
ymin, ymax = ax2.get_ylim()
xext = xmax - xmin
yext = ymax - ymin
if xext  yext:
w = h * xext/yext
else:
h = w * yext/xext

size = fig2.set_size_inches(w, h)
canvas2.print_figure('copy2.eps')
-

But this fails to plot the first rectange in the resulting plot. The
second, red rectangle is painted correctly in the resulting plot, but
the first one is totaly missing in the plot, leaving only a line in
the plot. Is there some kind of internal status that has to be
resettet in the actors?

Kind regards
Berthold
-- 
[EMAIL PROTECTED] / http://höllmanns.de/
[EMAIL PROTECTED] / http://starship.python.net/crew/bhoel/


-
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] Fwd: Problem with adding an artist from one axes instance to another

2007-02-07 Thread John Hunter
 But this fails to plot the first rectange in the resulting plot. The
 second, red rectangle is painted correctly in the resulting plot, but
 the first one is totaly missing in the plot, leaving only a line in
 the plot. Is there some kind of internal status that has to be
 resettet in the actors?

When you add an artist to the Axes, it checks to see if you have set a
transformation.  If you haven't, it will set the default axes
transformation.  If you have, it leaves the transformation unchanged.
This is why you are seeing the problems you see.

Before adding them to the second axes, you need to reset the
transformation for each line, text, etc


for artist in ax.get_child_artists():
   artist.set_transform(ax2.transData)
   if isinstance(artist, Line2D):
   ax2.add_line(artist)
   elif 

should work

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] troubles with contour3d, contourf3d in v0.87.5

2007-02-07 Thread Angus McMorland
Hi all,

Did any progress get made beyond this discussion below? I'm trying to
get contourf3D working, using latest svn, and it still seems to be
out-of-order. Contour3D works, but I get exactly the same errors (and
went exactly the same route trying to fix them) as Matthew.

On 13/01/07, Eric Firing [EMAIL PROTECTED] wrote:
 I don't know if everything 3D works, but the first error you note below

Which one is supposed to be the 'first' error mentioned here? In my
latest svn checkout, the line:

levels, colls = self.contourf(X, Y, Z, 20)

still appears to be present.

 is fixed in svn, and I suspect in 0.87.7, the last release.  0.87.5 is
 rather old--quite a bit has changed between minor releases.

 Eric

 Matthew Koichi Grimes wrote:
  contourf3D and contour3D seem to be broken in my copy of matplotlib
  0.87.5 that I installed from ubuntu edgy's repositories. Is this a known
  problem? I started going through axes3d.py etc and fixing the reported
  errors, but the error trail seems to go pretty deep across multiple
  files. Now I'm wondering if maybe this is something major that has
  already been fixed by more experienced hands in SVN or something.
 
  In the off chance that this is an unknown problem, I've enumerated the
  errors below. These all happened while attempting to run the example
  code in http://www.scipy.org/Cookbook/Matplotlib/mplot3D
 
  If it's fixed in SVN, I'll try installing that, but I haven't seen this
  bug mentioned in matplotlib's bug list on sourceforge.net.
 
  -- Matt
 
  When I called contourf3D the first time, I got the following error:
 
  snip
  File /usr/lib/python2.4/site-packages/matplotlib/axes3d.py, line 596,
  in contourf3D
  levels, colls = self.contourf(X, Y, Z, 20)
  TypeError: unpack non-sequence
  /snip
 
  As suggested in the examples page above, I went into contourf3D's
  function definition in axes3d.py and replaced:
 
  levels, colls = self.contourf(X, Y, Z, 20)
 
  with
 
  C = self.contourf(X, Y, Z, *args, **kwargs)
  levels, colls = (C.levels, C.collections)
 
  I then got a new error when calling contourf3D:
 
  snip
  exceptions.NameError Traceback (most
  recent call last)
 
  /home/mkg/Desktop/ipython console
 
  /usr/lib/python2.4/site-packages/matplotlib/axes3d.py in
  contourf3D(self, X, Y, Z, *args, **kwargs)
  604 zs = [z1] * (len(linec._verts[0])/2)
  605 zs += [z2] * (len(linec._verts[0])/2)
  -- 606 art3d.wrap_patch(linec, zs, fn=draw_polyc)
  607 self.auto_scale_xyz(X,Y,Z, had_data)
  608 return levels,colls
 
  NameError: global name 'draw_polyc' is not defined
  /snip
 
  After changing draw_polyc to art3d.draw_polyc, it complained that
  art3d.wrap_patch in fact only takes two arguments. So I changed
 
  art3d.wrap_patch(linec, zs, fn=draw_polyc)
 
  to
 
  art3d.wrap_patch(linec, zs)
 
  Which led to the latest error message:
 
  snip
  Traceback (most recent call last):
File
  /usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py,
  line 284, in expose_event
  self._render_figure(self._pixmap, w, h)
File
  /usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py,
  line 73, in _render_figure
  FigureCanvasAgg.draw(self)
File
  /usr/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py,
  line 391, in draw
  self.figure.draw(renderer)
File /usr/lib/python2.4/site-packages/matplotlib/figure.py, line
  538, in draw
  for a in self.axes: a.draw(renderer)
File /usr/lib/python2.4/site-packages/matplotlib/axes3d.py, line
  172, in draw
  Axes.draw(self, renderer)
File /usr/lib/python2.4/site-packages/matplotlib/axes.py, line 1057,
  in draw
  a.draw(renderer)
File /usr/lib/python2.4/site-packages/matplotlib/art3d.py, line 56,
  in call_draw3d
  self.draw3d(renderer)
File /usr/lib/python2.4/site-packages/matplotlib/art3d.py, line 184,
  in draw3d
  xs,ys = zip(*self._offsets)
  TypeError: zip() argument after * must be a sequence
  /snip
 
  Contour3D (not contourf3D) does work in that it successfully displays a
  plot, but when I mouseover this plot, my python console fills with the
  following error message (one repetition for each mouse event):
 
  snip
  /usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py in
  motion_notify_event(self, widget, event)
  178 # flipy so y=0 is bottom of canvas
  179 y = self.allocation.height - y
  -- 180 FigureCanvasBase.motion_notify_event(self, x, y)
  181 return False  # finish event propagation?
  182
 
  /usr/lib/python2.4/site-packages/matplotlib/backend_bases.py in
  motion_notify_event(self, x, y, guiEvent)
  885 event = MouseEvent('motion_notify_event', self, x, y,
  self._button, self._key, guiEvent=guiEvent)
  886 for func in self.callbacks.get('motion_notify_event',
  {}).values():
  -- 

Re: [Matplotlib-users] troubles with contour3d, contourf3d in v0.87.5

2007-02-07 Thread Eric Firing
Angus McMorland wrote:
 Hi all,
 
 Did any progress get made beyond this discussion below? I'm trying to
 get contourf3D working, using latest svn, and it still seems to be
 out-of-order. Contour3D works, but I get exactly the same errors (and
 went exactly the same route trying to fix them) as Matthew.
 
 On 13/01/07, Eric Firing [EMAIL PROTECTED] wrote:
 I don't know if everything 3D works, but the first error you note below
 
 Which one is supposed to be the 'first' error mentioned here? In my
 latest svn checkout, the line:
 
 levels, colls = self.contourf(X, Y, Z, 20)
 
 still appears to be present.
 
 is fixed in svn, and I suspect in 0.87.7, the last release.  0.87.5 is
 rather old--quite a bit has changed between minor releases.

Aha!  What is fixed is the corresponding error in contour3D--but 
strangely, the same error in contourf3D was never fixed.  I took a stab 
at it just now but failed--there is more wrong with it than this simple 
error--so I made it raise NotImplementedError.  I don't know whether 
contourf3D ever *did* work.  Nor am I sure exactly what it should do if 
it worked. The problem is that no one has taken on the maintenance of 
the 3D plotting.

Eric

-
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