drawing an arrow

I would like to draw one arrow on a plot as part of a label. I am
currently doing the following:

ax=gca()
myarrow=pylab.Arrow(-30,60,10,10,width=10)
ax.add_patch(myarrow)
pylab.show()

If I leave width=1, my arrow head is not visible due to the scale of
my plot, with width=10, the arrow head is visible, but the overall
arrow is wider than I would like. Is there another way to do this?
Can I get seperate control over the width of the arrowhead and the
width of the arrow. I wouldn't mind if the arrow itself was just a
thin line, but I would like a fancy arrow head than just doing this
-----> by drawing three lines.

Does anyone have a better way to do this?

Ryan

I’m trying to migrate from numarray to numpy.

By and large it is reasonably painless, substituting itemsize for itemsize() and numarray.mlab.squeeze/tri with numpy.squeeze/tri are all I have encountered so far.

However, I have not been able to get the numpy distribution of matplotlib working on OS-X

The matplotlib egg is installed to:

/Library/Frameworks/Python.framework/Versions/Current/lib/python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg

where I also have installed:

numarray-1.5.1-py2.4-macosx-10.4-ppc.egg

numpy-0.9.5.2053-py2.4-macosx-10.4-ppc.egg

scipy-0.4.5.1597-py2.4-macosx-10.4-ppc.egg

then

% python

import pylab

Traceback (most recent call last):

File “”, line 1, in ?

File “/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/pylab.py”, line 1, in ?

from matplotlib.pylab import *

File “/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/matplotlib/init.py”, line 744, in ?

defaultParams = {

File “/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/matplotlib/init.py”, line 273, in wrapper

ret = func(*args, **kwargs)

File “/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/matplotlib/init.py”, line 434, in _get_data_path

raise RuntimeError(‘Could not find the matplotlib data files’)

RuntimeError: Could not find the matplotlib data files

BTW, are there eggs for freetype/py-gtk etc. I’ve been using darwinports till now.

regards,

Graeme

Graeme O’Keefe, PhD, MACPSEM

Principal Medical Physicist

Centre for PET

Austin Hospital

Tel: (613)-9496-5767

Fax: (613) 9458-5023

Did you build and install the egg yourself, or did you download it
from somewhere? Freetype won't have an egg since it is not a python
library. In my tests I was able to add libpng and libfreetype static
libraries to the matplotlib egg and it worked fine. If you want, you
can try eggs I have posted for 0.86:
http://euclid.uits.iupui.edu/~cmoad/mpleggs/ . The matplotlib one has
the static libs added, so I would be interested to know if it works
for you. I can update these as well if you would like.

- Charlie

···

On 2/8/06, Graeme O'Keefe <graeme.okeefe@...981...> wrote:

I'm trying to migrate from numarray to numpy.

By and large it is reasonably painless, substituting itemsize for itemsize()
and numarray.mlab.squeeze/tri with numpy.squeeze/tri are all I have
encountered so far.

However, I have not been able to get the numpy distribution of matplotlib
working on OS-X

The matplotlib egg is installed to:
/Library/Frameworks/Python.framework/Versions/Current/lib/python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg
where I also have installed:
numarray-1.5.1-py2.4-macosx-10.4-ppc.egg
numpy-0.9.5.2053-py2.4-macosx-10.4-ppc.egg
scipy-0.4.5.1597-py2.4-macosx-10.4-ppc.egg

then
% python
>>> import pylab
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/pylab.py",
line 1, in ?
    from matplotlib.pylab import *
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/matplotlib/__init__.py",
line 744, in ?
    defaultParams = {
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/matplotlib/__init__.py",
line 273, in wrapper
    ret = func(*args, **kwargs)
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/matplotlib/__init__.py",
line 434, in _get_data_path
    raise RuntimeError('Could not find the matplotlib data files')
RuntimeError: Could not find the matplotlib data files

BTW, are there eggs for freetype/py-gtk etc. I've been using darwinports
till now.

Hi Charlie,

I'm a bit new to the whole 'egg' thing.

I retrieved the egg from Chris Fonnesbeck's homepage:
  http://homepage.mac.com/fonnesbeck/mac/

Anyway, the matplotlib data files issue is resolved, I have a copy of mpl-data in my ~/.matplotlib directory now. It is picked up as default.

I tried your egg, unfortunately, I've not been able to get wxWindows installed via darwinports.
I tried TkAgg, problems as well (libJPEG conflict), so I look to have a stuffed setup from darwinports.

Do you have a GTKAgg backend you could add the egg?

regards,

Graeme

···

On 09/02/2006, at 11:14 PM, Charlie Moad wrote:

On 2/8/06, Graeme O'Keefe <graeme.okeefe@...981...> wrote:

I'm trying to migrate from numarray to numpy.

By and large it is reasonably painless, substituting itemsize for itemsize()
and numarray.mlab.squeeze/tri with numpy.squeeze/tri are all I have
encountered so far.

However, I have not been able to get the numpy distribution of matplotlib
working on OS-X

The matplotlib egg is installed to:
/Library/Frameworks/Python.framework/Versions/Current/lib/python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg
where I also have installed:
numarray-1.5.1-py2.4-macosx-10.4-ppc.egg
numpy-0.9.5.2053-py2.4-macosx-10.4-ppc.egg
scipy-0.4.5.1597-py2.4-macosx-10.4-ppc.egg

then
% python

import pylab

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/pylab.py",
line 1, in ?
    from matplotlib.pylab import *
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/matplotlib/__init__.py",
line 744, in ?
    defaultParams = {
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/matplotlib/__init__.py",
line 273, in wrapper
    ret = func(*args, **kwargs)
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/matplotlib/__init__.py",
line 434, in _get_data_path
    raise RuntimeError('Could not find the matplotlib data files')
RuntimeError: Could not find the matplotlib data files

BTW, are there eggs for freetype/py-gtk etc. I've been using darwinports
till now.

Did you build and install the egg yourself, or did you download it
from somewhere? Freetype won't have an egg since it is not a python
library. In my tests I was able to add libpng and libfreetype static
libraries to the matplotlib egg and it worked fine. If you want, you
can try eggs I have posted for 0.86:
http://euclid.uits.iupui.edu/~cmoad/mpleggs/ . The matplotlib one has
the static libs added, so I would be interested to know if it works
for you. I can update these as well if you would like.

- Charlie

Wxpython comes preinstalled on 10.4 as does Tkinter. I am pretty
sure that the eggs that Chris has posted in addition to mine link
against those. You would probably need a custom build for
darwinports to play nice. I can't test any of this, so I may not be
much more help. Also, I have never tried gtkagg on osx since there is
no native gtk2 toolkit. I am sure it would work fine with
fink/darwinports gtk2 though under X11.app.

···

On 2/9/06, Graeme O'Keefe <graeme.okeefe@...981...> wrote:

Hi Charlie,

I'm a bit new to the whole 'egg' thing.

I retrieved the egg from Chris Fonnesbeck's homepage:
        http://homepage.mac.com/fonnesbeck/mac/

Anyway, the matplotlib data files issue is resolved, I have a copy of
mpl-data in my ~/.matplotlib directory now. It is picked up as default.

I tried your egg, unfortunately, I've not been able to get wxWindows
installed via darwinports.
I tried TkAgg, problems as well (libJPEG conflict), so I look to have
a stuffed setup from darwinports.

Do you have a GTKAgg backend you could add the egg?

regards,

Graeme

On 09/02/2006, at 11:14 PM, Charlie Moad wrote:

> On 2/8/06, Graeme O'Keefe <graeme.okeefe@...981...> wrote:
>> I'm trying to migrate from numarray to numpy.
>>
>> By and large it is reasonably painless, substituting itemsize for
>> itemsize()
>> and numarray.mlab.squeeze/tri with numpy.squeeze/tri are all I have
>> encountered so far.
>>
>> However, I have not been able to get the numpy distribution of
>> matplotlib
>> working on OS-X
>>
>> The matplotlib egg is installed to:
>> /Library/Frameworks/Python.framework/Versions/Current/lib/
>> python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-
>> ppc.egg
>> where I also have installed:
>> numarray-1.5.1-py2.4-macosx-10.4-ppc.egg
>> numpy-0.9.5.2053-py2.4-macosx-10.4-ppc.egg
>> scipy-0.4.5.1597-py2.4-macosx-10.4-ppc.egg
>>
>>
>> then
>> % python
>>>>> import pylab
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in ?
>> File
>> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
>> site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/
>> pylab.py",
>> line 1, in ?
>> from matplotlib.pylab import *
>> File
>> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
>> site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/
>> matplotlib/__init__.py",
>> line 744, in ?
>> defaultParams = {
>> File
>> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
>> site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/
>> matplotlib/__init__.py",
>> line 273, in wrapper
>> ret = func(*args, **kwargs)
>> File
>> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
>> site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/
>> matplotlib/__init__.py",
>> line 434, in _get_data_path
>> raise RuntimeError('Could not find the matplotlib data files')
>> RuntimeError: Could not find the matplotlib data files
>>
>> BTW, are there eggs for freetype/py-gtk etc. I've been using
>> darwinports
>> till now.
>
> Did you build and install the egg yourself, or did you download it
> from somewhere? Freetype won't have an egg since it is not a python
> library. In my tests I was able to add libpng and libfreetype static
> libraries to the matplotlib egg and it worked fine. If you want, you
> can try eggs I have posted for 0.86:
> http://euclid.uits.iupui.edu/~cmoad/mpleggs/ . The matplotlib one has
> the static libs added, so I would be interested to know if it works
> for you. I can update these as well if you would like.
>
> - Charlie
>

thanks Charlie,

I'm using darwinports/python24 whereas the preinstalled environment which includes wxpython is python23.

I have only been able to find a scipy egg for python24, so at the moment, I am going to use scipy/numpy with matplotlib/Numeric.
I'll wait until matplotlib/numpy makes it into darwinports.

I'm not particularly wedded to the idea of using py-gtk2, is there any compelling reason to use wxpython over py-gtk2?

regards,

Graeme

···

On 10/02/2006, at 11:10 PM, Charlie Moad wrote:

     Wxpython comes preinstalled on 10.4 as does Tkinter. I am pretty
sure that the eggs that Chris has posted in addition to mine link
against those. You would probably need a custom build for
darwinports to play nice. I can't test any of this, so I may not be
much more help. Also, I have never tried gtkagg on osx since there is
no native gtk2 toolkit. I am sure it would work fine with
fink/darwinports gtk2 though under X11.app.

On 2/9/06, Graeme O'Keefe <graeme.okeefe@...981...> wrote:

Hi Charlie,

I'm a bit new to the whole 'egg' thing.

I retrieved the egg from Chris Fonnesbeck's homepage:
        http://homepage.mac.com/fonnesbeck/mac/

Anyway, the matplotlib data files issue is resolved, I have a copy of
mpl-data in my ~/.matplotlib directory now. It is picked up as default.

I tried your egg, unfortunately, I've not been able to get wxWindows
installed via darwinports.
I tried TkAgg, problems as well (libJPEG conflict), so I look to have
a stuffed setup from darwinports.

Do you have a GTKAgg backend you could add the egg?

regards,

Graeme

On 09/02/2006, at 11:14 PM, Charlie Moad wrote:

On 2/8/06, Graeme O'Keefe <graeme.okeefe@...981...> >>> wrote:

I'm trying to migrate from numarray to numpy.

By and large it is reasonably painless, substituting itemsize for
itemsize()
and numarray.mlab.squeeze/tri with numpy.squeeze/tri are all I have
encountered so far.

However, I have not been able to get the numpy distribution of
matplotlib
working on OS-X

The matplotlib egg is installed to:
/Library/Frameworks/Python.framework/Versions/Current/lib/
python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-
ppc.egg
where I also have installed:
numarray-1.5.1-py2.4-macosx-10.4-ppc.egg
numpy-0.9.5.2053-py2.4-macosx-10.4-ppc.egg
scipy-0.4.5.1597-py2.4-macosx-10.4-ppc.egg

then
% python

import pylab

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/
pylab.py",
line 1, in ?
    from matplotlib.pylab import *
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/
matplotlib/__init__.py",
line 744, in ?
    defaultParams = {
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/
matplotlib/__init__.py",
line 273, in wrapper
    ret = func(*args, **kwargs)
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/
matplotlib/__init__.py",
line 434, in _get_data_path
    raise RuntimeError('Could not find the matplotlib data files')
RuntimeError: Could not find the matplotlib data files

BTW, are there eggs for freetype/py-gtk etc. I've been using
darwinports
till now.

Did you build and install the egg yourself, or did you download it
from somewhere? Freetype won't have an egg since it is not a python
library. In my tests I was able to add libpng and libfreetype static
libraries to the matplotlib egg and it worked fine. If you want, you
can try eggs I have posted for 0.86:
http://euclid.uits.iupui.edu/~cmoad/mpleggs/ . The matplotlib one has
the static libs added, so I would be interested to know if it works
for you. I can update these as well if you would like.

- Charlie

Graeme O'Keefe wrote:

I'm using darwinports/python24 whereas the preinstalled environment which includes wxpython is python23.

There are easy installs for python2.4 and wxPython 2.6.1 for python2.4:

http://www.undefined.org/python/

http://www.pythonmac.org/packages/
(or the wxPython download page)

I've built MPL for those versions in the past, I don't have the latest, and I haven't figure out eggs yet, but I should some day.

I'll wait until matplotlib/numpy makes it into darwinports.

Essentially, darwinports is kind of like a Unix within OS-X, so I'd go with all darwinports or no darwinports (for Python stuff)

I'm not particularly wedded to the idea of using py-gtk2, is there any compelling reason to use wxpython over py-gtk2?

It depends on how you are using it. wxPython lets you develop fairly native cross platform apps. It also works with the native Mac GUI (rather than X11). If you're using MPL stand alone (rather than embedded in a larger GUI app), and you're happy with darwinports and X11, then there is no advantage.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

Thanks Chris,

I’ve decided to deactivate the darwinports python and I’ve installed python2.4/wxPython from your links below.

I have MPL/numpy/scipy eggs from Chris Fonnesbeck (http://homepage.mac.com/fonnesbeck/mac) and Charlie Moad that uses wxPython/python24.

I had started looking at pygtk for GUI apps, but I shall now take a look at wx.

Thanks to you and Charlie for your help.

For those interested in the scipy/numpy egg, I had two issues I had was that the scipy egg didn’t seem to install correctly.

1

I found that if instead I unzipped the scipy egg file and then rm’d it, there was no problem.

ie.

cd /Library/Frameworks/Python.framework/Versions/Current/lib/python2.4/site-packages

sudo unzip scipy-0.4.5.1597-py2.4-macosx-10.4-ppc.egg

sudo mv scipy-0.4.5.1597-py2.4-macosx-10.4-ppc.egg scipy-0.4.5.1597-py2.4-macosx-10.4-ppc.bad.egg

so there must be some issue with the pkg loader from eggs rather than directories.

2.

In scipy/cluster/vq.py

I had to change line 306

from numpy.randint import randint

.

.

.

guess = take(obs,randint.rvs(0,No,k),0) # gjok20060208

guess = take(obs,randint(0,No,k),0)

regards,

Graeme

Graeme O’Keefe, PhD, MACPSEM

Principal Medical Physicist

Centre for PET

Austin Hospital

Tel: (613)-9496-5767

Fax: (613) 9458-5023

···

On 14/02/2006, at 8:20 AM, Christopher Barker wrote:

Graeme O’Keefe wrote:

I’m using darwinports/python24 whereas the preinstalled environment which includes wxpython is python23.

There are easy installs for python2.4 and wxPython 2.6.1 for python2.4:

http://www.undefined.org/python/

http://www.pythonmac.org/packages/

(or the wxPython download page)

I’ve built MPL for those versions in the past, I don’t have the latest, and I haven’t figure out eggs yet, but I should some day.

I’ll wait until matplotlib/numpy makes it into darwinports.

Essentially, darwinports is kind of like a Unix within OS-X, so I’d go with all darwinports or no darwinports (for Python stuff)

I’m not particularly wedded to the idea of using py-gtk2, is there any compelling reason to use wxpython over py-gtk2?

It depends on how you are using it. wxPython lets you develop fairly native cross platform apps. It also works with the native Mac GUI (rather than X11). If you’re using MPL stand alone (rather than embedded in a larger GUI app), and you’re happy with darwinports and X11, then there is no advantage.

-Chris

Christopher Barker, Ph.D.

Oceanographer

NOAA/OR&R/HAZMAT (206) 526-6959 voice

7600 Sand Point Way NE (206) 526-6329 fax

Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@…259…

Graeme O'Keefe wrote:

Thanks Chris,

I've decided to deactivate the darwinports python and I've installed
python2.4/wxPython from your links below.
I have MPL/numpy/scipy eggs from Chris Fonnesbeck
(http://homepage.mac.com/fonnesbeck/mac) and Charlie Moad that uses
wxPython/python24.

I had started looking at pygtk for GUI apps, but I shall now take a look
at wx.

Thanks to you and Charlie for your help.

For those interested in the scipy/numpy egg, I had two issues I had was
that the scipy egg didn't seem to install correctly.
### 1
I found that if instead I unzipped the scipy egg file and then rm'd it,
there was no problem.
ie.
cd /Library/Frameworks/Python.framework/Versions/Current/lib/python2.4/site-packages
sudo unzip scipy-0.4.5.1597-py2.4-macosx-10.4-ppc.egg
sudo
mv scipy-0.4.5.1597-py2.4-macosx-10.4-ppc.egg scipy-0.4.5.1597-py2.4-macosx-10.4-ppc.bad.egg

so there must be some issue with the pkg loader from eggs rather than
directories.

The scipy egg is certainly not zip-safe. easy_install should have recognized
that and unpacked the egg appropriately for you.

### 2.
In scipy/cluster/vq.py
I had to change line 306

from numpy.randint import randint
.
.
.
# guess = take(obs,randint.rvs(0,No,k),0) # gjok20060208
            guess = take(obs,randint(0,No,k),0)

That's a bug (due to me, probably). Fixed in SVN.

···

--
Robert Kern
robert.kern@...287...

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
  -- Richard Harter