numpy, matplotlib and masked arrays
hello fellow numpyneers, I'm not sure if this is a problem with numpy, matplotlib, EPD or me but here goes. The general problem is that either matplotlib has stopped plotting masked arrays correctly or numpy has changed the way masked arrays are presented. Or there is something strange with the Enthought Python Distribution or me. Many would agree with the latter ... First up, the platform: Linux pisaac-laptop 2.6.32-23-generic #37-Ubuntu SMP Fri Jun 11 07:54:58 UTC 2010 i686 GNU/Linux Next the symptom: matplotlib stops plotting masked array values at the first occurrence of a True mask value. Then the script: from matplotlib import pyplot import numpy a = numpy.array(range(0,100)) a[50] = -9999.0 b = numpy.ma.masked_where(a==-9999,a) pyplot.subplot(211) pyplot.plot(a) pyplot.subplot(212) pyplot.plot(b) pyplot.show() Now the twists: The above script works correctly with the Python installation from the Ubuntu repositories (10.04 LTS). Details of the installation are: Python V2.6.5 (r265:79063, Apr 16 2010, 13:09:56) matplotlib '0.99.1.1' numpy '1.3.0' The above script does not work correctly in either EPD-6.1-1 or EPD-6.2-2. Their details are: EPD-6.1-1 Python 2.6.4 |EPD 6.1-1 (32-bit)| (r264:75706, Nov 4 2009, 15:27:32) matplotlib '0.99.1.1' numpy '1.4.0' EPD-6.2-2 Python 2.6.5 |EPD 6.2-2 (32-bit)| (r265:79063, Mar 22 2010, 17:31:34) matplotlib '0.99.3' numpy '1.4.0' Since the matplotlib version is the same for the repository Python installation and the EPD-6.1-1 installation and the script works in the first but not the second, it suggests the problem is not just matplotlib. That seems to leave the numpy version change (from 1.3 to 1.4) or something in the EPD. Or me. Note that EPD-6.2-2 works fine with this script on WinXP. Any suggestions welcome and happy to supply further details if required. Yours in masked confusion, Peter
John Hunter wrote:
On Fri, Jul 9, 2010 at 8:03 PM, Peter Isaac <Peter.Isaac@monash.edu> wrote:
Note that EPD-6.2-2 works fine with this script on WinXP.
Any suggestions welcome
then just use epd-6.2.2 on winxp.
your-mpl-developer-channeling-steve-jobs, JDH
<wink> _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Hmmm, Be careful what you ask for, I suppose. I've been trying to wean myself off Windows and migrate to Linux, so far a rewarding and mostly enjoyable experience, while developing a Python-based quality control and post-processing system for ecosystem time series data. The end users will be on Win, MacOS and Linux, so unfortunately your elegant if somewhat non-pythonic suggestion doesn't quite help. Original message is now modified to read "Any helpful suggestions welcome" and I will offer a black polo neck T-shirt to the presenter of the most useful suggestion. Or the most entertaining ... Yours in greying-haired-desperation, Peter -- Peter Isaac School of Geography and Environmental Science Faculty of Arts Building 11 Monash University VICTORIA 3800 Australia Email: peter.isaac@monash.edu Phone: +61 3 99052591
Sat, 10 Jul 2010 11:03:47 +1000, Peter Isaac wrote:
I'm not sure if this is a problem with numpy, matplotlib, EPD or me but here goes. The general problem is that either matplotlib has stopped plotting masked arrays correctly or numpy has changed the way masked arrays are presented. Or there is something strange with the Enthought Python Distribution or me. Many would agree with the latter ... [clip] Since the matplotlib version is the same for the repository Python installation and the EPD-6.1-1 installation and the script works in the first but not the second, it suggests the problem is not just matplotlib. That seems to leave the numpy version change (from 1.3 to 1.4) or something in the EPD. Or me. Note that EPD-6.2-2 works fine with this script on WinXP.
It works fine for me with Numpy 1.4.0 and matplotlib 0.99.1.2, on Ubuntu. So it seems your problem is localised on the older EPD-6.1-1. The question is: do you need to support this older version of EPD at all? The problem does not appear to be that matplotlib has stopped plotting masked arrays properly, or that something crucial has changed in Numpy. -- Pauli Virtanen
Hi Pauli, Thanks for that. The script does not work in either EPD-6.1-1 or EPD-6.2-2 (the current release, see original post) on Ubuntu, so not supporting EPD-6.1-1 doesn't solve the problem unfortunately. However, your test suggests that it is not simply the change from numpy 1.3.0 to 1.4.0. This leaves either the EPD or the combination of numpy 1.4.0/matplotlib 0.99.3 on Ubuntu. I've never tried installing from the source, maybe that's where it's heading. Cheers, Peter ----- Original Message ----- From: Pauli Virtanen <pav@iki.fi> Date: Saturday, July 10, 2010 7:03 pm Subject: Re: [Numpy-discussion] numpy, matplotlib and masked arrays To: numpy-discussion@scipy.org
Sat, 10 Jul 2010 11:03:47 +1000, Peter Isaac wrote:
I'm not sure if this is a problem with numpy, matplotlib, EPD or me but here goes. The general problem is that either matplotlib has stopped> plotting masked arrays correctly or numpy has changed the way masked arrays are presented. Or there is something strange with the Enthought> Python Distribution or me. Many would agree with the latter ... [clip] Since the matplotlib version is the same for the repository Python installation and the EPD-6.1-1 installation and the script works in the first but not the second, it suggests the problem is not just matplotlib. That seems to leave the numpy version change (from 1.3 to 1.4) or something in the EPD. Or me. Note that EPD-6.2-2 works fine with this script on WinXP.
It works fine for me with Numpy 1.4.0 and matplotlib 0.99.1.2, on Ubuntu. So it seems your problem is localised on the older EPD-6.1-1.
The question is: do you need to support this older version of EPD at all? The problem does not appear to be that matplotlib has stopped plotting masked arrays properly, or that something crucial has changed in Numpy. -- Pauli Virtanen
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
participants (4)
-
John Hunter
-
Pauli Virtanen
-
Peter Isaac
-
Peter Isaac