[Matplotlib-users] index out of bounds if X not equals to y

2007-04-11 Thread elekis

hi all
I have a little script who just plot some tripet (random triplet) but I have
a index out of bound

What I don't understand is if Xl is diff of Yl , I have that error
Traceback (most recent call last):
 File test_plot3D.py, line 26, in module
   ax.plot_wireframe(X, Y, Z)
 File /usr/lib/python2.5/site-packages/matplotlib/axes3d.py, line 562, in
plot_wireframe
   txlines = [tX[i] for i in cii]
IndexError: index out of bounds

if there equals, all is perfect, but I haven't that.


there is the script

import numpy
import pylab as p
import matplotlib.axes3d as p3
import random

data = []
Xl = 10
Yl = 40  #if Yl = Xl , all is ok

#create data
for i in range(Xl):
   for j in range(Yl):
   data.append( (i,j,int( random.random()*10 ) )  )

X, Y = numpy.meshgrid(p.arange(0, Xl, 1), p.arange(0, Yl, 1))
Z = numpy.zeros( (Xl, Yl) )
for d in data:
   x, y, z = d
   Z[x, y] = z

fig = p.figure()
ax = p3.Axes3D(fig)
ax.plot_wireframe(X, Y, Z)
p.show()


any help.

thanks.

a++
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] . Newbie. Interactive and saving plots to file

2007-04-11 Thread massimo sandal

[EMAIL PROTECTED] ha scritto:
The question is, do people wanting to do this have to edit the 
matplotlibrc and restart Python each time, or is there some other way?


Try to look for savefig()

m.


--
Massimo Sandal
University of Bologna
Department of Biochemistry G.Moruzzi

snail mail:
Via Irnerio 48, 40126 Bologna, Italy

email:
[EMAIL PROTECTED]

tel: +39-051-2094388
fax: +39-051-2094387
begin:vcard
fn:Massimo Sandal
n:Sandal;Massimo
org:University of Bologna;Department of Biochemistry
adr:;;Via Irnerio 48;Bologna;;40126;Italy
email;internet:[EMAIL PROTECTED]
tel;work:+39-051-2094388
tel;fax:+39-051-2094387
x-mozilla-html:FALSE
version:2.1
end:vcard

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] index out of bounds if X not equals to y

2007-04-11 Thread Pierre GM
On Wednesday 11 April 2007 03:28:09 elekis wrote:

Hi,
Just some quick comments:


1. learn list comprehensions, they're far faster than regular loops.

data = [(i,j,int(numpy.random.random()*10))
   for i in range(XI) for j in range(JI)]

2. if you don't really need the triplets, but just the random part, just use:
Z = (numpy.random.random(XI*YI)*10).astype(int).reshape(Xl,Yl)

3. It's more efficient to use numpy.empty than numpy.zeros to initialize an 
array you're going to fill afterwards.

4. You may have found a bug in plot_wireframe, actually. The code doesn't look 
quite right. My understanding is that the 3d part is not really supported, 
either...


Hope it helps.

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] legend for a plot with markers every 20th data point?

2007-04-11 Thread Maddox Flower
Hi there,

say, I have x and y data like this (the real data I am working with is
from numerical simulations, though):

from numpy import arange, sin
x = arange( 0., 1., 0.001 )
y = sin( 50*x )

Now, a line plot would not look very decent because of the 1000
overlapping markers:

plot(x, y, '-ro')

Now, I'd rather have the same plot with a marker symbol only every 20th
data point. Of course, I can easily achieve this by slicing through my
data set and making two plots, one for the line and another one for the
markers:

line = plot(x, y, '-r')
markers = plot(x[::20], y[::20], 'ro')

Note that just doing a plot(x[::20],y[::20],'-ro') would 'distort' the
plot because the markers are being linked by straight lines.

What fails me is how to make a legend with the appropriate 'combined'
line style '-ro'? I have tried to supply the legend statement with that
linestyle:

legend( ['-ro'], ['data'] )

but it really expects a list of line instances, so that did not work.


Thanks for your suggestions,

Maddox

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] . Newbie. Interactive and saving plots to file

2007-04-11 Thread Christopher Barker
[EMAIL PROTECTED] wrote:
 I edited the matplotlibrc to interactive: False and backend: Agg, and it 
 works great. (produces .png)

no need. as the name implies, TKagg is already using agg internally, so 
you can just use pylab.savefig (or better yet, figure.savefig), and get 
the same high quality PNG. No need to switch back-ends. The plain Agg 
back-end is there for things like web apps, where you may not be able to 
run a GUI at all.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

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

[EMAIL PROTECTED]

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib and py2exe

2007-04-11 Thread Archana Ganesan

Hi Werner,

I tried what you suggested, using the setup file you had provided for
simple_plot.py. But I get the following error, what should I do abt this?
Traceback (most recent call last):
 File simple_plot.py, line 1, in ?
 File pylab.pyo, line 1, in ?
 File matplotlib\pylab.pyo, line 203, in ?
 File matplotlib\axes.pyo, line 16, in ?
 File matplotlib\axis.pyo, line 19, in ?
 File matplotlib\patches.pyo, line 42, in ?
 File matplotlib\patches.pyo, line 79, in Patch
 File matplotlib\cbook.pyo, line 352, in dedent
AttributeError: 'NoneType' object has no attribute 'splitlines'

Could you please tell me what I should do?

Thanks a lot,

Archana.

On 4/9/07, Werner F. Bruhin [EMAIL PROTECTED] wrote:


Hi Emmanuel,

Maybe your problem has to do with your enthought build of wxPython.  I
use standard builds from wxPython site.

Emmanuel wrote:
 when putting the full path of wxmsw26u_vc_enthought.dll  in setup.py
 like this

 data_files = [(lib\\matplotlibdata, mpfiles),
 matplotlib.get_py2exe_datafiles(), # if you don't
 use the lib option
You get two copies of matplotlibdata as you kept both of the two above
lines active.  You need to use the first one of you use the py2exe
option to create a library.zip which I put into a sub-folder called
'lib' in the sample setup.py file.
 C:\\Python24\\Lib\\site-packages\\wx-
2.6.1.0-py2.4-win32.egg\\wx\\wxmsw26u_vc_enthought.dll,
 ##wxmsw26u_vc_enthought.dll,
 (prog\\, python4dll)
]

You are also using an 'egg'.  I seem to recall that py2exe does not yet
really support that, but you might want to check on the py2exe list
(e.g. on the gmane mirror of it at
http://dir.gmane.org/gmane.comp.python.py2exe

Werner


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib conflicts with python-dateutils?

2007-04-11 Thread Joshua J. Kugler
On Thursday 05 April 2007 17:04, Andrew Straw wrote:
 Joshua J. Kugler wrote:
  Installing an egg today, I got this message from easy_install:
 
  /usr/bin/easy_install:5: UserWarning: Module dateutil was already
  imported from
  /usr/lib/python2.4/site-packages/matplotlib-0.87.7-py2.4-linux-i686.egg/d
 ateutil/__init__.pyc, but
  /usr/lib/python2.4/site-packages/python_dateutil-1.1-py2.4.egg is being
  added to sys.path
from pkg_resources import load_entry_point
 
  Investigating, it seems that Matplotlib includes python-dateutils
  wholesale in its egg, instead of depending on the python-dateutils egg
  and installing that, thus generating warning messages like these.

 Where did you get that matplotlib egg? Particularly on linux (which you
 appear to be using), distributing .eggs for matplotlib would be
 problematic because of all the 3rd party libraries required, so I didn't
 think they'd be officially distributed. Indeed, I don't see one for
 linux on the matplotlib download page.

I create it myself using the supplied setupegg.py script.

Would be possible to
  remove the dateutil module from future matplotlib eggs and simply rely on
  the python-dateutils egg?

 Since matplotlib doesn't require setuptools (other than for Python 2.3),
 there can be no install_requires field. (And even if we had it in the
 install_requires field, does your linux distribution's python-dateutil
 package include the egg info required for the install_requires field to
 work?)

Gotcha.

 If you built the egg yourself, you can re-build it with dateutil
 installed and then matplotlib's setup.py file won't include its own
 dateutil. Ditto for pytz.

Thanks for the tip!  Installed pytz and dateutil, and the created egg is what 
I desired.  Thanks!

j

-- 
Joshua Kugler   
Lead System Admin -- Senior Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/  ID 0xDB26D7CE
PO Box 80086 -- Fairbanks, AK 99708 -- Ph: 907-456-5581 Fax: 907-456-3111

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] 3d plotting question

2007-04-11 Thread belinda thom
Hi,

I'm having problems plotting two different kind of graphs on the same  
3D figure. Was hoping for some pointers.

Here's some basic test code, to demonstrate what I'd like to be able  
to do.

import copy
import pylab as P
import matplotlib.axes3d as P3
def test() :
 [X,Y] = P.meshgrid(P.linspace(-3,3,7),P.linspace(-3,3,7))
 Z = copy.deepcopy(X)
 Z1 = copy.deepcopy(X)
 for i in xrange(len(X)) :
 for j in xrange(len(X[0])) :
 Z[i][j] = X[i][j]*Y[i][j]
 Z1[i][j] = X[i][j]*Y[i][j] - 5
 P.close('all')
 fig = P.figure()
 ax = P3.Axes3D(fig)
 ax.scatter3D(P.ravel(X),P.ravel(Y),P.ravel(Z))
 ax.set_xlabel('x')
 ax.set_ylabel('y')
 ax.set_zlabel('z=x*y')
 P.show()
 ax.plot3D(P.ravel(X),P.ravel(Y),P.ravel(Z1))
 P.show()

Which produces an autoscale_view kwarg error appended below. I've  
tried calling plot3D with scalex=False and scaleY=False but that  
doesn't fix the problem. I've also tried creating a new axis (e.g.  
ax1) and doing ax1.Plot3D to no avail. It seems to be an error w/in  
matplotlib, but perhaps I'm misusing something. I haven't been able  
to find much documentation for this at http://www.scipy.org/Cookbook/ 
Matplotlib/mplot3D so have resorted to playing around.

If anyone also knows how to pass color-marker info into scatter3D, I  
have been able to create two of those on the same figure, so being  
able to change the colors of each and just using scatter3D would be a  
reasonable hack for my situation.

Advice always appreciated,

--b

In [25]: T.test()
 
---
exceptions.TypeError Traceback (most  
recent call last)

/Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ 
ipython console

/Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ 
threeD.py in test()
  18 ax.set_zlabel('z=x*y')
  19 P.show()
--- 20 ax.plot3D(P.ravel(X),P.ravel(Y),P.ravel(Z1))
  21 P.show()
  22

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/matplotlib/axes3d.py in plot3D(self, xs, ys, zs, *args,  
**kwargs)
 488 def plot3D(self, xs, ys, zs, *args, **kwargs):
 489 had_data = self.has_data()
-- 490 lines = Axes.plot(self, xs,ys, *args, **kwargs)
 491 if len(lines)==1:
 492 line = lines[0]

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/matplotlib/axes.py in plot(self, *args, **kwargs)
2129 lines = [line for line in lines] # consume the  
generator
2130
- 2131 self.autoscale_view(scalex=scalex, scaley=scaley)
2132 return lines
2133

TypeError: autoscale_view() got an unexpected keyword argument 'scalex'
  /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
site-packages/matplotlib/axes.py(2131)plot()
2130
- 2131 self.autoscale_view(scalex=scalex, scaley=scaley)
2132 return lines


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 3d plotting question

2007-04-11 Thread belinda thom
I also seem to have some other 3D plotting problems. Again, following  
some of the demo/test advice in the cookbook, I tried things like

   import pylab as p
   import matplotlib.axes3d as P3
   P3.test_surface()

and get errors (seems Axes3D needs a figure, no?).

I'm using matplotlib version 0.87.7.

Any ideas?

Thx,

--b


In [49]: P3.test_surface()
 
---
exceptions.TypeError Traceback (most  
recent call last)

/Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ 
ipython console

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/matplotlib/axes3d.py in test_surface()
 739
 740 def test_surface():
-- 741 ax = Axes3D()
 742
 743 X,Y,Z = get_test_data(0.05)

TypeError: __init__() takes at least 2 arguments (1 given)
  /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
site-packages/matplotlib/axes3d.py(741)test_surface()
 740 def test_surface():
-- 741 ax = Axes3D()
 742

ipdb

In [50]: P3.test_surface?
Type:   function
Base Class: type 'function'
String Form:function test_surface at 0x304a070
Namespace:  Interactive
File:   /Library/Frameworks/Python.framework/Versions/2.4/lib/ 
python2.4/site-packages/matplotlib/axes3d.py
Definition: P3.test_surface()
Docstring:
 no docstring


In [51]: P3.test_surface()
 
---
exceptions.TypeError Traceback (most  
recent call last)

/Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ 
ipython console

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/matplotlib/axes3d.py in test_surface()
 739
 740 def test_surface():
-- 741 ax = Axes3D()
 742
 743 X,Y,Z = get_test_data(0.05)

TypeError: __init__() takes at least 2 arguments (1 given)
  /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
site-packages/matplotlib/axes3d.py(741)test_surface()
 740 def test_surface():
-- 741 ax = Axes3D()
 742

ipdb

In [52]: P3.test_contour()
 
---
exceptions.TypeError Traceback (most  
recent call last)

/Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ 
ipython console

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/matplotlib/axes3d.py in test_contour()
 750
 751 def test_contour():
-- 752 ax = Axes3D()
 753
 754 X,Y,Z = get_test_data(0.05)

TypeError: __init__() takes at least 2 arguments (1 given)
  /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
site-packages/matplotlib/axes3d.py(752)test_contour()
 751 def test_contour():
-- 752 ax = Axes3D()
 753

ipdb 

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Bug in 0.9?

2007-04-11 Thread Joshua J. Kugler
We had some working code were were using with 0.87, but when we try to use it 
with 0.90, we get the following error:

File /usr/local/lib/python2.4/site-packages/EEIGraph/BaseGraph.py, line 250, 
in plotDate
line = self.main_axes.plot_date( g[:,0], g[:,1] )
  
File 
/usr/lib/python2.4/site-packages/matplotlib-0.90.0-py2.4-linux-i686.egg/matplotlib/axes.py,
 
line 2395, in plot_date
self.xaxis_date(tz)
  
File 
/usr/lib/python2.4/site-packages/matplotlib-0.90.0-py2.4-linux-i686.egg/matplotlib/axes.py,
 
line 1564, in xaxis_date
formatter = AutoDateFormatter(locator)
UnboundLocalError: local variable 'locator' referenced before assignment

It happens in this function:

def xaxis_date(self, tz=None):
Sets up x-axis ticks and labels that treat the x data as dates.

tz is the time zone to use in labeling dates.  Defaults to rc value.


thislocator = self.xaxis.get_major_locator()
if not isinstance(thislocator, DateLocator):
locator = AutoDateLocator(tz)
self.xaxis.set_major_locator(locator)

thisformatter = self.xaxis.get_major_formatter()
if not isinstance(thisformatter, DateFormatter):
formatter = AutoDateFormatter(locator)
self.xaxis.set_major_formatter(formatter)

It seems to happen when thislocator is an AutoDateLocator, thus locator is an 
AutoDateLocator, thus locator is not set, but thisformatter is a 
AutoDateFormatter, which doesn't seem to satisfy isinstance(thisformatter, 
DateFormatter)

I don't know enough about matplotlib internals to speculate further.

Any hints?

j

-- 
Joshua Kugler   
Lead System Admin -- Senior Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/  ID 0xDB26D7CE
PO Box 80086 -- Fairbanks, AK 99708 -- Ph: 907-456-5581 Fax: 907-456-3111

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Matplotlib 0.90.0 on OS-X with wxPython2.8.3

2007-04-11 Thread Christopher Barker
Hi all,

I've got the MPL 0.90.0 installer on pythonmac working OK with:

Python2.5
wxPython2.8.3

I accomplished this by removing:

/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/backends/_wxagg.so

Which disables the accelerator that doesn't work with wxPython 2.8

What we really need to do is get Ken's changes into a release, but I 
have my immediate needs met.

-Chris




-- 
Christopher Barker, Ph.D.
Oceanographer

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

[EMAIL PROTECTED]

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 3D curve and errors in axes3d

2007-04-11 Thread belinda thom
Hi,

I'm replying to this older thread

http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/ 
msg02100.html

because it relates very much to my recent problem, posted at http:// 
www.mail-archive.com/matplotlib-users@lists.sourceforge.net/ 
msg03037.html. This problem seems more general than just the two  
circumstances you mentioned.

I'm finding the problem w/any use plot3D in matplotlib.axes3d, e.g.:

import copy
import pylab as P
import matplotlib.axes3d as P3
fig = P.figure()
ax = P3.Axes3D(fig)
ax.plot3D(P.ravel(X),P.ravel(Y),P.ravel(Z)) # this command will fail

with the errors identical to those you report. I modified  
matplotlib's axis.py in a similar way as your suggestion. Line 2131  
went from:

self.autoscale_view(scalex=scalex,scaley=scaley)

to:

self.autoscale_view() #scalex=scalex,scaley=scaley)

It took me a while to verify that this fixed the problem b/c I didn't  
at first realize I'd have to kill ipython and restart it (so that it  
sees the new axes.py file).

I wonder what this change to axes.py will break. Any ideas?

Thx,

--b

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Bug in 0.9?

2007-04-11 Thread Eric Firing
It is a bug that is fixed in svn.  The this part of the names is 
incorrect. The revised function is:


 def xaxis_date(self, tz=None):
 Sets up x-axis ticks and labels that treat the x data as dates.

 tz is the time zone to use in labeling dates.  Defaults to rc 
value.
 

 locator = self.xaxis.get_major_locator()
 if not isinstance(locator, DateLocator):
 locator = AutoDateLocator(tz)
 self.xaxis.set_major_locator(locator)

 formatter = self.xaxis.get_major_formatter()
 if not isinstance(formatter, DateFormatter):
 formatter = AutoDateFormatter(locator)
 self.xaxis.set_major_formatter(formatter)


Similarly for yaxis_date.

Eric


Joshua J. Kugler wrote:
 We had some working code were were using with 0.87, but when we try to use it 
 with 0.90, we get the following error:
 
 File /usr/local/lib/python2.4/site-packages/EEIGraph/BaseGraph.py, line 
 250, 
 in plotDate
 line = self.main_axes.plot_date( g[:,0], g[:,1] )
   
 File 
 /usr/lib/python2.4/site-packages/matplotlib-0.90.0-py2.4-linux-i686.egg/matplotlib/axes.py,
  
 line 2395, in plot_date
 self.xaxis_date(tz)
   
 File 
 /usr/lib/python2.4/site-packages/matplotlib-0.90.0-py2.4-linux-i686.egg/matplotlib/axes.py,
  
 line 1564, in xaxis_date
 formatter = AutoDateFormatter(locator)
 UnboundLocalError: local variable 'locator' referenced before assignment
 
 It happens in this function:
 
 def xaxis_date(self, tz=None):
 Sets up x-axis ticks and labels that treat the x data as dates.
 
 tz is the time zone to use in labeling dates.  Defaults to rc value.
 
 
 thislocator = self.xaxis.get_major_locator()
 if not isinstance(thislocator, DateLocator):
 locator = AutoDateLocator(tz)
 self.xaxis.set_major_locator(locator)
 
 thisformatter = self.xaxis.get_major_formatter()
 if not isinstance(thisformatter, DateFormatter):
 formatter = AutoDateFormatter(locator)
 self.xaxis.set_major_formatter(formatter)
 
 It seems to happen when thislocator is an AutoDateLocator, thus locator is an 
 AutoDateLocator, thus locator is not set, but thisformatter is a 
 AutoDateFormatter, which doesn't seem to satisfy isinstance(thisformatter, 
 DateFormatter)
 
 I don't know enough about matplotlib internals to speculate further.
 
 Any hints?
 
 j
 


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] 3D plotting lines / markers / colors question

2007-04-11 Thread belinda thom
Hi,

What kwargs are available for plot3D and scatter3D?

Thanks,

--b

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 3D curve and errors in axes3d

2007-04-11 Thread belinda thom

On Apr 11, 2007, at 4:47 PM, belinda thom wrote:

 Hi,

 I'm replying to this older thread

 http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/ 
 msg02100.html

 because it relates very much to my recent problem, posted at http:// 
 www.mail-archive.com/matplotlib-users@lists.sourceforge.net/ 
 msg03037.html. This problem seems more general than just the two  
 circumstances you mentioned.

 I'm finding the problem w/any use plot3D in matplotlib.axes3d, e.g.:

FYI: It also is a problem when using plot3d

--b


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Bug in 0.9?

2007-04-11 Thread Joshua J. Kugler
On Wednesday 11 April 2007 15:49, Eric Firing wrote:
 It is a bug that is fixed in svn.  The this part of the names is
 incorrect. The revised function is:


  def xaxis_date(self, tz=None):
  Sets up x-axis ticks and labels that treat the x data as dates.

  tz is the time zone to use in labeling dates.  Defaults to rc
 value.
  

  locator = self.xaxis.get_major_locator()
  if not isinstance(locator, DateLocator):
  locator = AutoDateLocator(tz)
  self.xaxis.set_major_locator(locator)

  formatter = self.xaxis.get_major_formatter()
  if not isinstance(formatter, DateFormatter):
  formatter = AutoDateFormatter(locator)
  self.xaxis.set_major_formatter(formatter)


 Similarly for yaxis_date.

Thank you!  That did the trick!

j

-- 
Joshua Kugler   
Lead System Admin -- Senior Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/  ID 0xDB26D7CE
PO Box 80086 -- Fairbanks, AK 99708 -- Ph: 907-456-5581 Fax: 907-456-3111

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 3D curve and errors in axes3d

2007-04-11 Thread Eric Firing
Belinda,

John has checked in some fixes for axes3d recently, and your test code 
now runs with the version in svn--except for the problem that you should 
use P.show() only once in a given script.  (I think there is some 
backend for which you can get away with using it more than once, but 
this is not good practice.)

Eric

belinda thom wrote:
 On Apr 11, 2007, at 4:47 PM, belinda thom wrote:
 
 Hi,

 I'm replying to this older thread

 http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/ 
 msg02100.html

 because it relates very much to my recent problem, posted at http:// 
 www.mail-archive.com/matplotlib-users@lists.sourceforge.net/ 
 msg03037.html. This problem seems more general than just the two  
 circumstances you mentioned.

 I'm finding the problem w/any use plot3D in matplotlib.axes3d, e.g.:
 
 FYI: It also is a problem when using plot3d
 
 --b
 
 
 -
 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to share your
 opinions on IT  business topics through brief surveys-and earn cash
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 3d plotting question

2007-04-11 Thread belinda thom
Thanks for the input.

Its easy for me to patch my own machine, but for students in my class  
who are using lab machines, its more difficult. Hopefully I can get  
someone to upgrade the machines in the lab I'm using. (Its difficult  
to get facilities people to agree to update coursework installs mid- 
semester).

Morale of my story: don't expect 3d plotting to necessarily work / be  
easy if you don't carefully test it first :-(.

I too would be interested in robustifying / making more accessible  
the 3d stuff, but will have to wait until after the class I'm  
teaching ends.

--b


On Apr 11, 2007, at 6:57 PM, Tim Leslie wrote:

 Even in the lastest svn version these test methods are all broken to a
 greater or lesser degree (as I found out a couple of days ago). If I
 find time over the weekend I'll try to fix them up. In the mean time,
 if you change them to look something like

 fig = pylab.figure()
 ax = Axes3d(fig)
 ... etc

 it should get you one step closer to having them working. I'll post
 back here if/when I manage to get them cleaned up.

 Cheers,

 Tim



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 3d plotting question

2007-04-11 Thread belinda thom
 Hi Belinda,

 I've been playing with 3D plots and scatter plots in the past few days
 and I've been able to get them working. You should be able to pass in
 a c=color parameter as you would for a normal 2d scatter plot. I've
 been doing this and it's working for me.

Interesting.

I'm on Mac OS X 4.8.9, running Python 2.4.4, using Matplotlib 0.87.7  
w/TkAgg (I might be using Wx, but would have to get a problem w/my  
machine's and all the students' lab machines wx libraries updated).

When I try using the c='r' parameter, I run into problems. I also  
tried c='red'. One big problem for me is that which kwargs can be  
used where and what values they can take on is not well documented.

For instance, in plot3d (as opposed to plot3D) you can pass the  
typical Matplotlib 'r.-' string and it just works. But in  
plot_wireframe, for example, it appears you must use different kwargs  
(for instance, linestyle='solid' and color='some RGB value'). I am  
not sure about these notions, b/c I've had to deduce them from the  
code and various google-based snippets.

That's why I'm asking for more guidance about the various kwarg usages.

Is there any good place to find more cohesive info online? The most  
useful place I could find seemed to be in matplotlib's  
collections.py, an __init__ function's documentation (that's where I  
deduced, for instance, the linestyle and RGB color info). If there  
isn't such a place, someone should probably modify the matplotlib 3d  
cookbook. I'd be willing to do that but I'd first need to have a  
better understanding about the various functions' kwargs :-).

I'll append a case I used to generate an error, as well as the error  
reporting below. I'm also not quite sure how to use the errors that  
are reported to help me track down where the problems might be, so if  
anyone has some advice on that, it might help me better help myself  
in the future.

As always, thx,

--b


Example Code:
-
import copy
import pylab as P
import matplotlib.axes3d as P3
def test() :
 [X,Y] = P.meshgrid(P.linspace(-3,3,7),P.linspace(-3,3,7))
 Z = copy.deepcopy(X)
 Z1 = copy.deepcopy(X)
 for i in xrange(len(X)) :
 for j in xrange(len(X[0])) :
 Z[i][j] = X[i][j]*Y[i][j]
 Z1[i][j] = X[i][j]*Y[i][j] - 5
 P.close('all')
 fig = P.figure()
 ax = P3.Axes3D(fig)
 ax.Plot3D(ravel(X),ravel(Y),ravel(Z),c='r')

In [213]: T.test()
 
---
exceptions.AttributeErrorTraceback (most  
recent call last)

/Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ 
ipython console

/Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ 
threeDa.py in test()
  11 Z1[i][j] = X[i][j]*Y[i][j] - 5
  12 P.close('all')
  13 fig = P.figure()
  14 ax = P3.Axes3D(fig)
--- 15 ax.Plot3D(ravel(X),ravel(Y),ravel(Z),c='red')

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/matplotlib/axes3d.py in __getattr__(self, k)
 660
 661 def __getattr__(self, k):
-- 662 return getattr(self.wrapped,k)
 663
 664 def __setattr__(self, k,v):

AttributeError: Axes3DI instance has no attribute 'Plot3D'
  /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
site-packages/matplotlib/axes3d.py(662)__getattr__()
 661 def __getattr__(self, k):
-- 662 return getattr(self.wrapped,k)
 663

ipdb 

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Fwd: 3d plotting question

2007-04-11 Thread belinda thom
Forwarding this to the list

I'm curious if you run into another problem I recently reported. Can  
you do, e.g.:

import copy
import pylab as P
import matplotlib.axes3d as P3
def test() :
 [X,Y] = P.meshgrid(P.linspace(-3,3,7),P.linspace(-3,3,7))
 Z = copy.deepcopy(X)
 Z1 = copy.deepcopy(X)
 for i in xrange(len(X)) :
 for j in xrange(len(X[0])) :
 Z[i][j] = X[i][j]*Y[i][j]
 Z1[i][j] = X[i][j]*Y[i][j] - 5
 P.close('all')
 fig = P.figure()
 ax = P3.Axes3D(fig)
 ax.plot3d(ravel(X),ravel(Y),ravel(Z),'r.-')

or do you instead get an error in matplotlib's axes.py, complaining  
about self.autoscale_view and a scalex parameter? For more on the  
hack I made to axes.py file which then allowed me to use plot3d, see  
http://www.mail-archive.com/[EMAIL PROTECTED]/ 
msg03041.html.

Thanks for providing  more info.

--b

Begin forwarded message:

 From: Richard Brown [EMAIL PROTECTED]
 Date: April 11, 2007 8:41:37 PM PDT
 To: belinda thom [EMAIL PROTECTED]
 Subject: Re: [Matplotlib-users] 3d plotting question

 On 12/04/07, belinda thom [EMAIL PROTECTED] wrote:
 I also seem to have some other 3D plotting problems. Again, following
 some of the demo/test advice in the cookbook, I tried things like

import pylab as p
import matplotlib.axes3d as P3
P3.test_surface()

 I too just encountered the same problem - what is the last version of
 mpl for which doing this worked? (I'm using 0.9 revision 3131)

 -- 
 Richard Brown
 Ph.D. Candidate
 Dept. of Mechanical Engineering
 University of Canterbury, NZ


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 3D curve and errors in axes3d

2007-04-11 Thread belinda thom
Thanks Eric!

I'm kind of afraid to upgrade to the SVN version b/c I fear something  
else might break (I've yet to install matplotlib from source b/c of a  
few nagging Mac OS X issues).

What would you recommend?

There's also the issue of having to upgrade student machines for  
which I'm not admin. Grrr.

--b

On Apr 11, 2007, at 6:19 PM, Eric Firing wrote:

 Belinda,

 John has checked in some fixes for axes3d recently, and your test  
 code now runs with the version in svn--except for the problem that  
 you should use P.show() only once in a given script.  (I think  
 there is some backend for which you can get away with using it more  
 than once, but this is not good practice.)

 Eric

 belinda thom wrote:
 On Apr 11, 2007, at 4:47 PM, belinda thom wrote:
 Hi,

 I'm replying to this older thread

 http://www.mail-archive.com/matplotlib- 
 [EMAIL PROTECTED]/ msg02100.html

 because it relates very much to my recent problem, posted at  
 http:// www.mail-archive.com/matplotlib- 
 [EMAIL PROTECTED]/ msg03037.html. This problem seems  
 more general than just the two  circumstances you mentioned.

 I'm finding the problem w/any use plot3D in matplotlib.axes3d, e.g.:
 FYI: It also is a problem when using plot3d
 --b
 - 
 
 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to  
 share your
 opinions on IT  business topics through brief surveys-and earn cash
 http://www.techsay.com/default.php? 
 page=join.phpp=sourceforgeCID=DEVDEV
 ___
 Matplotlib-users mailing list
 [EMAIL PROTECTED]
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users