3D curve and errors in axes3d

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

FYI: It also is a problem when using plot3d

--b

···

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

Hi,

I'm replying to this older thread

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

because it relates very much to my recent problem, posted at [Matplotlib-users] 3d plotting question. 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.:

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

matplotlib-users 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.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

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

matplotlib-users 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.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

belinda thom wrote:

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?

I don't know; I see from your earlier message that Tim Leslie says some of the things you are trying to do are still broken, and his patches are what John committed, so svn is certainly no better than what Tim is working with now.

I don't think that anything has changed since 0.90 in such a way as to require changing both the compiled parts and the pure python parts, so you could try simply replacing the pure python part.

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

That certainly makes the prospect of doing any kind of upgrade less attractive. I don't have a good solution.

···

--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

matplotlib-users 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.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Eric,

belinda thom wrote:

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?

I don't know; I see from your earlier message that Tim Leslie says some of the things you are trying to do are still broken, and his patches are what John committed, so svn is certainly no better than what Tim is working with now.

Ick. I hadn't noticed the version he was using. Should I file a bug report? and if so, where?

I don't think that anything has changed since 0.90 in such a way as to require changing both the compiled parts and the pure python parts, so you could try simply replacing t

This was the info that I was missing in order to understand how to proceed. Not sure how I'd replace "just the python part" --- presumably something manual? But I'm glad to hear this is a possible option.

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

> That certainly makes the prospect of doing any kind of upgrade less attractive. I don't have a good solution.

Me neither :-). I will try and get permission to upgrade axis.py w/my quick fix commenting out the kwargs in line 2131 of axes.py, as this is the quick option and I need something ASAP. You seem to know quite a bit about matplotlib. If you have any idea what this hack might break, I'd appreciate your insight so I know what to be wary of.

Thx,
--b

···

On Apr 12, 2007, at 12:16 AM, Eric Firing wrote:

belinda thom wrote:

Me neither :-). I will try and get permission to upgrade axis.py w/my quick fix commenting out the kwargs in line 2131 of axes.py, as this is the quick option and I need something ASAP. You seem to know quite a bit about matplotlib. If you have any idea what this hack might break, I'd appreciate your insight so I know what to be wary of.

Your "fix" is rendering the scalex and scaley kwargs of Axes.plot ineffective, so that both axes will be autoscaled regardless of the value of these kwargs. It might have no practical consequence for what you are doing. The larger concern is that I can't figure out how making that change would be needed--the error message you show doesn't make sense to me, given what I see in the code, which means I don't understand something critical--and in fact this "fix" doesn't seem to be needed on my system. So, maybe this particular problem really has been fixed since 0.9, and Tim is referring to some other sort of problem in the 3d code. (I am simply assuming he is working from svn, but I don't know this for a fact.) All very confusing and unsatisfactory.

Eric

I agree.

Here's more info (redundant?) regarding what I've tried, in case it clarifies. (Ultimately, I will obviously need to upgrade to 0.9, at which point I can report back on if this fixed the problem on my machine, but I can't do that until after the semester is over, mid May). I'm running MacPython 2.4.4. I've got matplotlib 0.87.7 w/TkAgg. I'm using IPython 0.7.4.svn.r2010, called with the -pylab flag. I'm running the tests reported here on a G5 (I've also seen them on a G4), using OS X 10.4.8.

In [2]: import matplotlib.axes3d as P3
In [3]: f = P.figure()
In [4]: ax = P3.Axes3D(f)
In [5]: ax.plot3d([1,2,3],[1,2,3],[1,2,3],'ro-')
In [6]: P.show()

···

On Apr 12, 2007, at 11:02 AM, Eric Firing wrote:

belinda thom wrote:

Me neither :-). I will try and get permission to upgrade axis.py w/my quick fix commenting out the kwargs in line 2131 of axes.py, as this is the quick option and I need something ASAP. You seem to know quite a bit about matplotlib. If you have any idea what this hack might break, I'd appreciate your insight so I know what to be wary of.

Your "fix" is rendering the scalex and scaley kwargs of Axes.plot ineffective, so that both axes will be autoscaled regardless of the value of these kwargs. It might have no practical consequence for what you are doing. The larger concern is that I can't figure out how making that change would be needed--the error message you show doesn't make sense to me, given what I see in the code, which means I don't understand something critical--and in fact this "fix" doesn't seem to be needed on my system. So, maybe this particular problem really has been fixed since 0.9, and Tim is referring to some other sort of problem in the 3d code. (I am simply assuming he is working from svn, but I don't know this for a fact.)

All very confusing and unsatisfactory.

---------------------------------------------------------------------------
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 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 #self.autoscale_view()#scalex=scalex, scaley=scaley)
    2133 return lines

TypeError: autoscale_view() got an unexpected keyword argument 'scalex'

In [6]:

NOTE COMMENTED OUT LINE 2132. NOW I'LL DO THE SAME THING (FIRST RESTARTING IPYTHON) W/THE OTHER LINE COMMENTED OUT INSTEAD,

No error occurs and the figure plots as one would expect.

If there is anything else I can do to clear things up, please let me know.

I've got a list of other things that don't work the way I'd expect that I will post soon. Perhaps you can give me a link to where to find the changes made since 0.87.7 first, as I'm new to reading that kind of thing. Hopefully when Tim tries this stuff out on his end, we'll know more.

Thanks,

--b

belinda thom wrote:

[...]

Here's more info (redundant?) regarding what I've tried, in case it clarifies. (Ultimately, I will obviously need to upgrade to 0.9, at which point I can report back on if this fixed the problem on my machine, but I can't do that until after the semester is over, mid May). I'm running MacPython 2.4.4. I've got matplotlib 0.87.7 w/TkAgg. I'm using IPython 0.7.4.svn.r2010, called with the -pylab flag. I'm running the tests reported here on a G5 (I've also seen them on a G4), using OS X 10.4.8.

Belinda,

I was not paying close enough attention and did not realize that you are all the way back at 0.87.7. I think that trying to do any kind of piecemeal updating of that to get 3d working decently is an exercise in futility; a lot of things have changed since then, some problems in 3d have been fixed but it still can't be considered operational, and Tim's recent work has been post-0.90, so upgrading to that is still not likely to be very satisfactory. A new release is planned soon--maybe next week?--and that would certainly get you closer. But overall, I think that trying to use mpl 3d functionality for a class this term is not a good idea. There is a lot you can do in 2d with 0.87.7; I think you would really be best advised to find a way to make that adequate for the purposes of your class this term.

The easiest way to see some of the things that have changed is to go to
matplotlib download | SourceForge.net and browse the archive, especially lib/matplotlib, where the pure python parts are. 0.87.7 was released at revision 2835. You can also get an overview from CHANGELOG and API_CHANGES.

Eric