Re: [Matplotlib-users] plotting wind-speed time series

2007-05-07 Thread Derek Hohls
John
 
If you look through the thread, you will see I have responded before
saying I that had used this code successfully.  I did not find any 
detailed documentation necessary... the program is really self-
explanatory and well-commented.
 
Here is a sample that works for me:
 
from pylab import *
import windrose
figure(figsize=(8,8), facecolor='w')
ventV = [ 0.2, 0.2, 0.35, 0.09,  0.55,  0.5,  0.2, 0.33, 0.44, 0.22 ]
ventD = [ 65., 59., 74.,  231.,  268.,  283., 166., 214., 66., 114.]
freq,ax=windrose.windplot(ventV,ventD,counts=False,speed_classes=[0.1,0.2,0.3,0.4,0.5],sectors=8,style='bar2')
title("And here is the title!", fontsize=14)
fig=ax.get_figure()
#for leg in fig.legends:
# setp(leg.get_texts(), fontsize=8)
draw()
show()
 
The commented code is in case you want to set the font
size for the legend.
 
Derek
 
PS As I said before, I suggest you get the latest version.

>>> <[EMAIL PROTECTED]> 2007/05/07 11:47 PM >>>

Thanks to everybody that responded to my question.

After looking at the different options, I do agree that windrose.py
fits my need the best.  Unfortunately, there is insufficient information
embedded in the code to the point where I can use it.  I sent the author
a email requesting more info and hopefully he would respond.

Just in case, have anybody used this code successfully?  If so, could
you please share a sample dataset to use windrose.py?

Thanks,

> 
> 
> grab "windrose.py" at the end of this thread
> 
>http://www.nabble.com/windrose-t1392107.html 

>I've not used it but I think it is what you are looking for: a
windrose module for python.

>JDH


--
John Henry



-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/ 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/matplotlib-users 


-- 
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
 
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html 
 
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html 
 
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
[EMAIL PROTECTED]


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plotting wind-speed time series

2007-05-07 Thread kc106_2005-matplotlib
Thanks to everybody that responded to my question.

After looking at the different options, I do agree that windrose.py fits my 
need the best.  Unfortunately, there is insufficient information embedded in 
the code to the point where I can use it.  I sent the author a email requesting 
more info and hopefully he would respond.

Just in case, have anybody used this code successfully?  If so, could you 
please share a sample dataset to use windrose.py?

Thanks,

> 
> 
> grab "windrose.py" at the end of this thread
> 
>http://www.nabble.com/windrose-t1392107.html

>I've not used it but I think it is what you are looking for: a windrose module 
>for python.

>JDH

 
--
John Henry



-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Anyone using TkAgg on OS X successfully

2007-05-07 Thread Russell E Owen
At 2:30 PM -0600 2007-05-07, Samuel M. Smith wrote:
>If you see my other post titled (Segmentation Fault TkAgg backend). 
>I was getting a seg fault
>It appears to be a problem with the MPL in the scipy superpack. When 
>I reinstalled your package it
>worked again. The reason I installed the scipy superpack was it was 
>the only package installer for scipy.
>Any chance of you posting a package installer of scipy?

I'm afraid it's not likely, at least not in the near term. I don't 
really need scipy (though it would be handy at times) and work is 
keeping me busy on other tasks.

-- Russell

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Anyone using TkAgg on OS X successfully

2007-05-07 Thread Samuel M. Smith
If you see my other post titled (Segmentation Fault TkAgg backend). I  
was getting a seg fault
It appears to be a problem with the MPL in the scipy superpack. When  
I reinstalled your package it
worked again. The reason I installed the scipy superpack was it was  
the only package installer for scipy.
Any chance of you posting a package installer of scipy?

On 7 May 2007, at 13:06 , Russell E. Owen wrote:

> In article <[EMAIL PROTECTED]>,
>  "Samuel M. Smith" <[EMAIL PROTECTED]>
>  wrote:
>
>> Anyone using TkAgg on OSX 10.4 with MPL 0.90.0 and Python 2.5
>> successfully?
>
> Absolutely. I use the package at   
> (which
> I also built). One quirk is that I use ActiveState Aqua Tcl/Tk  
> (8.4.11)
> rather than Apple's built-in Tcl/Tk. But it should work either way.
>
> What problems are you having?
>
> -- Russell
>
>
> -- 
> ---
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

**
Samuel M. Smith Ph.D.
2966 Fort Hill Road
Eagle Mountain, Utah 84005-4108
801-768-2768 voice
801-768-2769 fax
**
"The greatest source of failure and unhappiness in the world is
giving up what we want most for what we want at the moment"
**



-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Animation with WX on OSX

2007-05-07 Thread Samuel M. Smith
>
> I'm not too surprised. OS-X double buffers behind the scenes, and I
> think it waits until it thinks there is good reason to before it  
> updates
> the screen. You need to force it in your code quite explicitly in a  
> way
> you don't on other platforms. You might try adding a Refresh() and
> Update() call to the relevant wx.Window. Or maybe you need to do a
> wx.App.Yield()

I am not sure how I do that from matplotlib running in ipython
How do you get a handle to wx.Window and wx.App.Yield from MPL?
I do animations by calling MPL functions inside ipython --pylab.
Do you approach animations in a completely different way?


Sam


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Anyone using TkAgg on OS X successfully

2007-05-07 Thread Russell E. Owen
In article <[EMAIL PROTECTED]>,
 "Samuel M. Smith" <[EMAIL PROTECTED]> 
 wrote:

> Anyone using TkAgg on OSX 10.4 with MPL 0.90.0 and Python 2.5  
> successfully?

Absolutely. I use the package at  (which 
I also built). One quirk is that I use ActiveState Aqua Tcl/Tk (8.4.11) 
rather than Apple's built-in Tcl/Tk. But it should work either way.

What problems are you having?

-- Russell


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] (no subject)

2007-05-07 Thread Ken McIvor
On May 7, 2007, at 11:21 AM, Christopher Barker wrote:
> Praveen Gopalakrishnan wrote:
>> Hi, I'm a newbie trying to install matplotlib (0.87) on Linux
>> (2.6.11,FC4). I have Python 2.4, wxPython 2.8.3 and all required
>> libraries for matplotlib (freetype, libpng, zlib). I'm tring to use
>> wxAgg as the backend, and there is a build error for matplotlib when
>> it tries to compile the wxagg files..
>
> I'm pretty sure that 0.87 will not build with wxPython2.8.* I think  
> it's
> been fixed in SVN, but not in the 0.90 release either.

Chris is correct, you cannot build 0.87's _wxagg module using  
wxPython 2.8.  However, you can edit setup.py and change the value of  
the BUILD_WXAGG variable from 'auto' to 0.  This will inhibit the  
compilation of the module and everything should work fine.

Ken

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] (no subject)

2007-05-07 Thread Christopher Barker
Praveen Gopalakrishnan wrote:
> Hi, I'm a newbie trying to install matplotlib (0.87) on Linux
> (2.6.11,FC4). I have Python 2.4, wxPython 2.8.3 and all required
> libraries for matplotlib (freetype, libpng, zlib). I'm tring to use
> wxAgg as the backend, and there is a build error for matplotlib when
> it tries to compile the wxagg files..

I'm pretty sure that 0.87 will not build with wxPython2.8.* I think it's 
been fixed in SVN, but not in the 0.90 release either.

You can:

switch to wxPython 2.6

or

search the archives of this list for the fix and patch your source 
(search for my name, that may help)

or

Use the SVN version of MPL.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Animation with WX on OSX

2007-05-07 Thread Christopher Barker
Samuel M. Smith wrote:
> Anyone able to "see" an animation using WXAgg 2.6 or otherwise on OS X 
> 10.4 python 2.5 mpl 0.90.0

Please post a as-small-as-you-can-make-it sample, and I'll give it test 
here.

> I can save figures and make a movie but nothing shows in the figure 
> window until the animation is over.

I'm not too surprised. OS-X double buffers behind the scenes, and I 
think it waits until it thinks there is good reason to before it updates 
the screen. You need to force it in your code quite explicitly in a way 
you don't on other platforms. You might try adding a Refresh() and 
Update() call to the relevant wx.Window. Or maybe you need to do a 
wx.App.Yield()

> even the example anim.py has the same behavior. 

oops, I guess I can try that! Maybe I can get to it later today -- no 
time now!

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] (no subject)

2007-05-07 Thread Praveen Gopalakrishnan
Hi,
I'm a newbie trying to install matplotlib (0.87) on Linux (2.6.11,FC4). I have 
Python 2.4, wxPython 2.8.3 and all required libraries for matplotlib (freetype, 
libpng, zlib). I'm tring to use wxAgg as the backend, and there is a build 
error for matplotlib when it tries to compile the wxagg files.. I've attached 
the resulting output from the build.

It will be great help if anyone can give throw some light on how to fix this 
build error.

Thanks
Praveen
 



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com python setup.py build
GTK requires pygtk
GTKAgg requires pygtk
setup.py:267: DeprecationWarning: The wxPython compatibility package is no 
longer automatically generated or actively maintained.  Please switch to the wx 
package as soon as possible.
  import wxPython
running build
running build_py
creating build
creating build/lib.linux-i686-2.4
copying lib/pylab.py -> build/lib.linux-i686-2.4
creating build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/windowing.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/agg.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/cbook.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/table.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/transforms.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/mathtext.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/axes.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/figure.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/art3d.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/_pylab_helpers.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/text.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/_mathtext_data.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/patches.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/mathtext2.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/collections.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/axes3d.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/proj3d.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/mlab.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/__init__.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/cm.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/colors.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/image.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/axis.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/_contour.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/colorbar.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/pylab.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/texmanager.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/legend.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/quiver.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/font_manager.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/backend_bases.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/nxutils.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/afm.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/dates.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/axis3d.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/_transforms.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/contour.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/pyparsing.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/lines.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/finance.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/_cm.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/ticker.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/widgets.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/_image.py -> build/lib.linux-i686-2.4/matplotlib
copying lib/matplotlib/artist.py -> build/lib.linux-i686-2.4/matplotlib
creating build/lib.linux-i686-2.4/matplotlib/backends
copying lib/matplotlib/backends/backend_agg.py -> 
build/lib.linux-i686-2.4/matplotlib/backends
copying lib/matplotlib/backends/backend_pdf.py -> 
build/lib.linux-i686-2.4/matplotlib/backends
copying lib/matplotlib/backends/backend_qt.py -> 
build/lib.linux-i686-2.4/matplotlib/backends
copying lib/matplotlib/backends/backend_gdk.py -> 
build/lib.linux-i686-2.4/matplotlib/backends
copying lib/matplotlib/backends/backend_ps.py -> 
build/lib.linux-i686-2.4/matplotlib/backends
copying lib/matplotlib/backends/tkagg.py -> 
build/lib.linux-i686-2.4/matplotlib/backends
copying lib/matplotlib/backends/

Re: [Matplotlib-users] grd file

2007-05-07 Thread Lionel Roubeyrie
Le Vendredi 20 Avril 2007 18:10, Jeff Whitaker a écrit :
> Lionel Roubeyrie wrote:
> > By grd file, I mean csv like file, with one line by value, like
> > X1  Y1  Z1
> > X2  Y1  Z2
> > X3  Y1  Z3
> > ...
> > X1  Y2  Zk
> > X2  Y2  Zk+1
> > ...
> > Xi  Yj  Zn
> > this is in geographic format, where there is a repetition in the X values
> > and the Y values, because the grid is regular, but not in lambert
> > projection, then I can't retrieve the dimensions of the grid.
> >
> > [SNIP]
>
> Lionel:  Well, I guess you are stuck without knowing what the dimensions
> of the grid are.  Can't you find that out from the data provider?
>
> -Jeff
Hi Jeff,
sorry for the latency.
Problems come from the implementation of GMT into our programs, which only 
uses Lambert coords, and we are now with a deadlock. We're going to replace 
it by MPL because we believe in it and we think it's the better way to make 
plots and maps, so if for that we have to rewrite all the codes, we can then 
try to catch geographic coords instead of Lambert.
Thanks for your help, and for basemap too.

-- 
Lionel Roubeyrie - [EMAIL PROTECTED]
Chagé d'études et de maintenance
LIMAIR - la Surveillance de l'Air en Limousin
http://www.limair.asso.fr


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Segmentation Fault TkAgg backend

2007-05-07 Thread Samuel M. Smith
I decided that the scipy superpack might be at fault so I installed  
numpy 1.02 from the macpython packages and
then reinstalled MPL 0.90.0 from the macpython packages and now TkAgg  
works.  Also scipy still seems to work.


So apparently Fonnesbeck's build of scipy superpack has a problem  
with TkAgg.



On 5 May 2007, at 18:37 , Samuel M. Smith wrote:

I have been using WXAgg but I have had better success using TkAgg  
for animations.
So I tried TkAgg and get a segmentation fault. I haven't used it in  
a while so I don't know
when it stopped working. I have ipython 0.80  OS x 10.4.9  
scipysuperpack with MPL 0.90.0


anyone have any idea or used TkAgg lately?


backend TkAgg version 8.4
Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)
Type "copyright", "credits" or "license" for more information.

IPython 0.8.0 -- An enhanced Interactive Python.
?   -> Introduction to IPython's features.
%magic  -> Information about IPython's 'magic' % functions.
help-> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

  Welcome to pylab, a matplotlib-based Python environment.
  For more information, type 'help(pylab)'.

In [1]: plot([1,2,5])
Segmentation fault
albook:samuel$



**
Samuel M. Smith Ph.D.
2966 Fort Hill Road
Eagle Mountain, Utah 84005-4108
801-768-2768 voice
801-768-2769 fax
**
"The greatest source of failure and unhappiness in the world is
giving up what we want most for what we want at the moment"
**




**
Samuel M. Smith Ph.D.
2966 Fort Hill Road
Eagle Mountain, Utah 84005-4108
801-768-2768 voice
801-768-2769 fax
**
"The greatest source of failure and unhappiness in the world is
giving up what we want most for what we want at the moment"
**


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Reusing basemap instance

2007-05-07 Thread Jeff Whitaker
Jesper Larsen wrote:
> On Monday 07 May 2007 16:02, Jesper Larsen wrote:
>   
>> The deepcopy operation takes almost as much time as creating a new basemap
>> instance. If the basemap instance was unchanged by my plotting I would of
>> course be able to avoid doing this and simply use a basemap instance
>> without copying it. Am I right in asserting that this is not the case? Any
>> suggestions on how to avoid deepcopying it?
>> 
>
> I forgot to mention that the reason I have to deepcopy it is that I cannot 
> use 
> the basemap methods:
>
> drawparallels()
> drawmeridians()
> fillcontinents()
> drawcoastlines()
>
> without an axes instance which is again tied to a figure instance. These 
> methods seem to modify the basemap instance (as far as I recall).
>
> - Jesper
>
>   

Jesper:  Can you be more specific about why you need a deepcopy?  Those 
methods you mention do not modify the Basemap instance, although they do 
modify the axes instance they are used with.  It shouldn't be a problem 
reusing the Basemap instance with a new axes instance (without using  
using deepcopy).

-Jeff

-- 
Jeffrey S. Whitaker Phone  : (303)497-6313
Meteorologist   FAX: (303)497-6449
NOAA/OAR/PSD  R/PSD1Email  : [EMAIL PROTECTED]
325 BroadwayOffice : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] From list of objects to plotting

2007-05-07 Thread John Hunter
On 5/6/07, Jouni K. Seppänen <[EMAIL PROTECTED]> wrote:
> Tommy Grav <[EMAIL PROTECTED]> writes:
>
> > I would now like to plot a vs e for all the obj objects in nlist.
> > how do I do that? I tried
> >
> > plot(nlist[:].a,nlist[:].e,'ko')
>
> You have a list of objects that have attributes named a and e; these
> are not attributes of the list. Try
>
>   plot([x.a for x in nlist], [x.e for x in nlist], 'ko')

Another idiom which I use a lot

  a,e = zip(*[(o.a, o.e) for o in nlist])

or if I have a lot of attributes I want dumped into arrays

  a,b,c,d = map(numpy.asarray, zip(*[(o.a, o.b, o.c, o.d) for o in data]))

JDH

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Reusing basemap instance

2007-05-07 Thread Jesper Larsen
On Monday 07 May 2007 16:02, Jesper Larsen wrote:
> The deepcopy operation takes almost as much time as creating a new basemap
> instance. If the basemap instance was unchanged by my plotting I would of
> course be able to avoid doing this and simply use a basemap instance
> without copying it. Am I right in asserting that this is not the case? Any
> suggestions on how to avoid deepcopying it?

I forgot to mention that the reason I have to deepcopy it is that I cannot use 
the basemap methods:

drawparallels()
drawmeridians()
fillcontinents()
drawcoastlines()

without an axes instance which is again tied to a figure instance. These 
methods seem to modify the basemap instance (as far as I recall).

- Jesper

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Reusing basemap instance

2007-05-07 Thread Jesper Larsen
Hi matplotlib basemap users,

I am doing a lot of plots of the same area but for different vertical levels, 
time steps and parameters. I am therefore trying to reuse my basemap instance 
(which in some cases is quite time consuming to setup). I am doing this by 
making a deepcopy of a basemap instance created by this simple function 
(where mapresolution is a function giving the different map resolutions for 
different areas):

def getbasemap(area):
  """Returns basemap instance for a given area."""
  from matplotlib.toolkits import basemap
  mapres = mapresolution(area)
  m = basemap.Basemap(area[0], area[1], area[2], area[3], resolution=mapres)
  return m

The deepcopy operation takes almost as much time as creating a new basemap 
instance. If the basemap instance was unchanged by my plotting I would of 
course be able to avoid doing this and simply use a basemap instance without 
copying it. Am I right in asserting that this is not the case? Any 
suggestions on how to avoid deepcopying it?

Cheers,
Jesper


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] activate/deactivate RectangleSelector

2007-05-07 Thread Matthias Michler
Hello list,

refering to the thread 'activate/deactivate RectangleSelector' of the 
developer-mailing-list I thought a bit about the problem because I found it 
quite irritating that the RS couldn't be stopped during zooming.

I attached a patch including Martin's example and my proposal to (de)activate 
RectangleSelector including deactivation during zoom mode.

I hope this is helpful for others too and can be part of matplotlib.

best regards,
Matthias

PS: Should I send those mails to developer mailing list?
Index: widgets.py
===
--- widgets.py	(revision 3261)
+++ widgets.py	(working copy)
@@ -12,6 +12,7 @@
 from lines import Line2D
 from numerix import array
 from transforms import blend_xy_sep_transform
+from matplotlib._pylab_helpers import Gcf
 
 class LockDraw:
 """
@@ -952,24 +953,40 @@
 warnings.warn('Use SpanSelector instead!', DeprecationWarning)
 SpanSelector.__init__(self, ax, onselect, 'horizontal', **kwargs)
 
+
 class RectangleSelector:
 """
 Select a min/max range of the x axes for a matplotlib Axes
 
 Example usage:
 
-  ax = subplot(111)
-  ax.plot(x,y)
+from matplotlib.widgets import  RectangleSelector
+from pylab import *
 
-  def onselect(eclick, erelease):
+def onselect(eclick, erelease):
   'eclick and erelease are matplotlib events at press and release'
-  print 'startposition : (%f,%f)'%(eclick.xdata, eclick.ydata)
-  print 'endposition   : (%f,%f)'%(erelease.xdata, erelease.ydata)
-  print 'used button   : ', eclick.button
+  print ' startposition : (%f, %f)' % (eclick.xdata, eclick.ydata)
+  print ' endposition   : (%f, %f)' % (erelease.xdata, erelease.ydata)
+  print ' used button   : ', eclick.button
 
-  span = Selector(ax, onselect,drawtype='box')
-  show()
+def toggle_Selector(event):
+print ' Key pressed.'
+if event.key in ['Q', 'q'] and toggle_Selector.RS.active:
+print ' RectangleSelector deactivated.'
+toggle_Selector.RS.set_active(False)
+if event.key in ['A', 'a'] and not toggle_Selector.RS.active:
+print ' RectangleSelector activated.'
+toggle_Selector.RS.set_active(True)
 
+x = arange(100)/(99.0)
+y = sin(x)
+fig = figure
+ax = subplot(111)
+ax.plot(x,y)
+
+toggle_Selector.RS = RectangleSelector(ax, onselect, drawtype='line')
+connect('key_press_event', toggle_Selector)
+show()
 """
 def __init__(self, ax, onselect, drawtype='box',
  minspanx=None, minspany=None, useblit=False,
@@ -998,8 +1015,6 @@
 Use type if you want the mouse to draw a line, a box or nothing
 between click and actual position ny setting
 drawtype = 'line', drawtype='box' or drawtype = 'none'.
-
-
 """
 self.ax = ax
 self.visible = True
@@ -1009,6 +1024,7 @@
 self.canvas.mpl_connect('button_release_event', self.release)
 self.canvas.mpl_connect('draw_event', self.update_background)
 
+self.active = True# for activation / deactivation
 self.to_draw = None
 self.background = None
 
@@ -1049,6 +1065,14 @@
 
 def ignore(self, event):
 'return True if event should be ignored'
+# If RectangleSelector is not active :
+if not self.active:
+return True
+
+# If zoom mode was activated
+if not (Gcf.get_active().toolbar.mode == ''):
+return True
+
 # If no button was pressed yet ignore the event if it was out
 # of the axes
 if self.eventpress == None:
@@ -1139,6 +1163,17 @@
 self.update()
 return False
 
+def set_active(self, active):
+""" Use this to activate / deactivate the RectangleSelector
+
+from your program with an boolean variable 'active'.
+"""
+self.active = active
+
+def get_active(self):
+""" to get status of active mode (boolean variable)"""
+return self.active 
+
 class Lasso(Widget):
 def __init__(self, ax, xy, callback=None, useblit=True):
 self.axes = ax
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users