|
From: Eric E. <ems...@ob...> - 2006-01-19 12:50:28
|
Hi,
I have switched to numpy (I was using numarray before) with matplotlib.
I have now however a problem when doing for example:
x = numpy.core.multiarray.arange(0.,6.,1.)
y = numpy.core.multiarray.arange(0.,6.,1.)
clos = numpy.core.multiarray.arange(0.,1.,.1)
scatter(x,y,c=clos)
I get:
.................
/usr/lib/python2.4/site-packages/matplotlib/numerix/__init__.py in
typecode(a)
89 # so assume numpy.
90 def typecode(a):
---> 91 return a.dtypechar
92 def iscontiguous(a):
93 return a.flags.contiguous
AttributeError: 'numpy.ndarray' object has no attribute 'dtypechar'
ONE OTHER question:
- is it possible when using "scatter" to have the specified color
(c=...) projected on the present colormap like when using an array of
colors, instead of just having levels of grey? I have N points that I
wish to plot but all with the same color which I wish to specify by a
simple number between e.g. 0 and 1 corresponding to my colormap.
thanks
Eric
--
===============================================================
Observatoire de Lyon ems...@ob...
9 av. Charles-Andre tel: +33 4 78 86 83 84
69561 Saint-Genis Laval Cedex fax: +33 4 78 86 83 86
France http://www-obs.univ-lyon1.fr/eric.emsellem
===============================================================
|
|
From: Darren D. <dd...@co...> - 2006-01-19 13:43:52
|
On Thursday 19 January 2006 07:49, Eric Emsellem wrote: > Hi, > > I have switched to numpy (I was using numarray before) with matplotlib. > > I have now however a problem when doing for example: > > x =3D numpy.core.multiarray.arange(0.,6.,1.) > y =3D numpy.core.multiarray.arange(0.,6.,1.) > clos =3D numpy.core.multiarray.arange(0.,1.,.1) > scatter(x,y,c=3Dclos) > > I get: > ................. > /usr/lib/python2.4/site-packages/matplotlib/numerix/__init__.py in > typecode(a) > =A0 =A0 =A089 =A0 =A0 # so assume numpy. > =A0 =A0 =A090 =A0 =A0 def typecode(a): > ---> 91 =A0 =A0 =A0 =A0 return a.dtypechar > =A0 =A0 =A092 =A0 =A0 def iscontiguous(a): > =A0 =A0 =A093 =A0 =A0 =A0 =A0 return a.flags.contiguous > > AttributeError: 'numpy.ndarray' object has no attribute 'dtypechar' This reflects a recent change in numpy. Try updating your MPL from cvs, it= =20 should be fixed there. Darren |
|
From: Christopher B. <Chr...@no...> - 2006-01-19 18:51:47
|
Eric Emsellem wrote:
> I have switched to numpy (I was using numarray before) with matplotlib.
> x = numpy.core.multiarray.arange(0.,6.,1.)
Why not use:
x = numpy.arange(0.,6.,1.)
Or maybe better with MPL:
import matplotlib.numerix as nx
x = nx.arange(0.,6.,1.)
after setting numerix appropriately in .matplotlibrc.
-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
Chr...@no...
|
|
From: Charlie M. <cw...@gm...> - 2006-01-19 19:04:18
|
I agree. numpy.core.multiarray is the base object for arrays, but it not really supposed to be used directly. All arrays should have a dtypechar property, and since that was the source of your original error, I am even more sure you shouldn't use it directly. Chris's suggestions are the correct approach. On 1/19/06, Christopher Barker <Chr...@no...> wrote: > Eric Emsellem wrote: > > > I have switched to numpy (I was using numarray before) with matplotlib. > > > x =3D numpy.core.multiarray.arange(0.,6.,1.) > > Why not use: > > x =3D numpy.arange(0.,6.,1.) > > Or maybe better with MPL: > > import matplotlib.numerix as nx > x =3D nx.arange(0.,6.,1.) > > after setting numerix appropriately in .matplotlibrc. > > -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 > > Chr...@no... > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi= les > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D103432&bid=3D230486&dat= =3D121642 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Robert K. <rob...@gm...> - 2006-01-19 19:08:25
|
Charlie Moad wrote: > I agree. numpy.core.multiarray is the base object for arrays, but it > not really supposed to be used directly. All arrays should have a > dtypechar property, and since that was the source of your original > error, I am even more sure you shouldn't use it directly. As Darren noted, A.dtypechar was recently changed to A.dtype.char in numpy, and matplotlib in CVS now reflects that change. -- Robert Kern rob...@gm... "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter |
|
From: Eric E. <ems...@ob...> - 2006-01-19 21:53:42
|
Ok thanks. (in fact the cvs version seemed to have solved it for some reason) I did that only because when doing "help(arange)" it gave me that dependency and I wanted to be sure to use the right one here. So why is Ipython giving me that instead of the most direct one? thanks again Eric > I agree. numpy.core.multiarray is the base object for arrays, but it > not really supposed to be used directly. All arrays should have a > dtypechar property, and since that was the source of your original > error, I am even more sure you shouldn't use it directly. Chris's > suggestions are the correct approach. > > On 1/19/06, Christopher Barker <Chr...@no...> wrote: > > Eric Emsellem wrote: > > > > > I have switched to numpy (I was using numarray before) with matplotlib. > > > > > x = numpy.core.multiarray.arange(0.,6.,1.) > > > > Why not use: > > > > x = numpy.arange(0.,6.,1.) > > > > Or maybe better with MPL: > > > > import matplotlib.numerix as nx > > x = nx.arange(0.,6.,1.) > > > > after setting numerix appropriately in .matplotlibrc. > > > > -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 > > > > Chr...@no... > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > > for problems? Stop! Download the new AJAX search engine that makes > > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > -- -------------------------------------------------------------------------- Ce message a été envoyé depuis le webmail IMP (Internet Messaging Program) |
|
From: Fernando P. <Fer...@co...> - 2006-01-19 22:00:18
|
Eric Emsellem wrote: > Ok thanks. (in fact the cvs version seemed to have solved it for some reason) > > I did that only because when doing "help(arange)" it gave me that dependency and > I wanted to be sure to use the right one here. So why is Ipython giving me that > instead of the most direct one? Because IPython doesn't read mailing lists or manuals :) It only shows what the inspect.get* routines return, and that's where arange _lives_ at the internal, implementation level. IPython tries really, really hard to make your life easy, but there's a limit to its powers :) Cheers, f |
|
From: Robert K. <rob...@gm...> - 2006-01-19 22:03:22
|
Eric Emsellem wrote: > Ok thanks. (in fact the cvs version seemed to have solved it for some reason) > > I did that only because when doing "help(arange)" it gave me that dependency and > I wanted to be sure to use the right one here. So why is Ipython giving me that > instead of the most direct one? arange is defined in the module numpy.core.multiarray. That information is stored in the builtin_function_or_method object itself. It can't know that it is being imported into the root numpy namespace or anywhere else. Consequently, the help() function can't know that you are accessing it as "from numpy import *; help(arange)", and only gives you the information that it knows. -- Robert Kern rob...@gm... "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter |