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.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users