Matplotlib or numpy bug?

Hi matplotlib users,

The script below produces weird arrows when using numpy 1.2.1 and
matplotlib trunk. When I reinstall numpy 1.2.0 instead it seems fine.
I use the Agg backend. I am not sure where to start in tracking the
bug down so I will just post the rather sparse information that I
have.

Please let me know if you need any further information from me.

Best regards,
Jesper

import math
import numpy.ma as ma
import pylab as p

a = ma.ones((10,10))
a[:2,:] = ma.masked
a[:,9:] = ma.masked
b = ma.array(-a)
nx, ny = a.shape

for i in range(nx):
  for j in range(ny):
    a[i,j] = a[i,j]*math.cos(i*j)
    b[i,j] = -b[i,j]*math.sin(i*j)

print a

p.quiver(a,b)
p.grid(True)
p.savefig('test1.png')

Jesper Larsen wrote:

Hi matplotlib users,

The script below produces weird arrows when using numpy 1.2.1 and
matplotlib trunk. When I reinstall numpy 1.2.0 instead it seems fine.
I use the Agg backend. I am not sure where to start in tracking the
bug down so I will just post the rather sparse information that I
have.

It looks OK to me with mpl and numpy from svn.

Eric

···

Please let me know if you need any further information from me.

Best regards,
Jesper

import math
import numpy.ma as ma
import pylab as p

a = ma.ones((10,10))
a[:2,:] = ma.masked
a[:,9:] = ma.masked
b = ma.array(-a)
nx, ny = a.shape

for i in range(nx):
  for j in range(ny):
    a[i,j] = a[i,j]*math.cos(i*j)
    b[i,j] = -b[i,j]*math.sin(i*j)

print a

p.quiver(a,b)
p.grid(True)
p.savefig('test1.png')

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Hi Eric and Mauro,

Thanks for your answers.

2008/11/27 Eric Firing <efiring@...202...>:

It looks OK to me with mpl and numpy from svn.

I tried upgrading to numpy from svn as well. Unfortunately the problem
persists (I have attached a plot). I have seen the problem on two of
my Ubuntu machines. Maybe it is caused by my specific setup and
supporting libraries.

Since I have a working solution and it does not seem to affect others
(based on a survey of two:-) let us just leave the problem for now. If
someone else encounter it please let me know and I will try to dive a
bit into the issue. If the problem turns up again when I have a need
to upgrade numpy (which is probably when matplotlib requires me to) I
will also look into it.

Best regards,
Jesper

test1.png

Hi Jesper,

confirming the problem over here, as well. both numpy and mpl from svn
(also on an Ubuntu 8.04 machine).

good luck,
Paul

Jesper Larsen, on 2008-11-27 02:10, wrote:

···

Hi Eric and Mauro,

Thanks for your answers.

2008/11/27 Eric Firing <efiring@...202...>:

It looks OK to me with mpl and numpy from svn.

I tried upgrading to numpy from svn as well. Unfortunately the problem
persists (I have attached a plot). I have seen the problem on two of
my Ubuntu machines. Maybe it is caused by my specific setup and
supporting libraries.

Since I have a working solution and it does not seem to affect others
(based on a survey of two:-) let us just leave the problem for now. If
someone else encounter it please let me know and I will try to dive a
bit into the issue. If the problem turns up again when I have a need
to upgrade numpy (which is probably when matplotlib requires me to) I
will also look into it.

Best regards,
Jesper

------------------------------------------------------------------------

------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Paul Ivanov wrote:

Hi Jesper,

confirming the problem over here, as well. both numpy and mpl from svn
(also on an Ubuntu 8.04 machine).

Just checking: did you do a clean build of numpy (deleting any old build directory) and then a clean build of mpl? Distutils is not very smart about dependencies.

Eric

···

good luck,
Paul

Jesper Larsen, on 2008-11-27 02:10, wrote:

Hi Eric and Mauro,

Thanks for your answers.

2008/11/27 Eric Firing <efiring@...202...>:

It looks OK to me with mpl and numpy from svn.

I tried upgrading to numpy from svn as well. Unfortunately the problem
persists (I have attached a plot). I have seen the problem on two of
my Ubuntu machines. Maybe it is caused by my specific setup and
supporting libraries.

Since I have a working solution and it does not seem to affect others
(based on a survey of two:-) let us just leave the problem for now. If
someone else encounter it please let me know and I will try to dive a
bit into the issue. If the problem turns up again when I have a need
to upgrade numpy (which is probably when matplotlib requires me to) I
will also look into it.

Best regards,
Jesper

------------------------------------------------------------------------

------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Eric Firing, on 2008-11-28 17:55, wrote:

Paul Ivanov wrote:

Hi Jesper,

confirming the problem over here, as well. both numpy and mpl from svn
(also on an Ubuntu 8.04 machine).

Just checking: did you do a clean build of numpy (deleting any old build
directory) and then a clean build of mpl? Distutils is not very smart
about dependencies.

Eric

Yeah, just checked again against numpy 1.3.0.dev6118 and mpl r6456 after
clearing everything.

Paul

···

good luck,
Paul

Jesper Larsen, on 2008-11-27 02:10, wrote:

Hi Eric and Mauro,

Thanks for your answers.

2008/11/27 Eric Firing <efiring@...202...>:

It looks OK to me with mpl and numpy from svn.

I tried upgrading to numpy from svn as well. Unfortunately the problem
persists (I have attached a plot). I have seen the problem on two of
my Ubuntu machines. Maybe it is caused by my specific setup and
supporting libraries.

Since I have a working solution and it does not seem to affect others
(based on a survey of two:-) let us just leave the problem for now. If
someone else encounter it please let me know and I will try to dive a
bit into the issue. If the problem turns up again when I have a need
to upgrade numpy (which is probably when matplotlib requires me to) I
will also look into it.

Best regards,
Jesper

------------------------------------------------------------------------

------------------------------------------------------------------------

-------------------------------------------------------------------------

This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win
great prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users