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

 [Matplotlib-users] 3D curve and errors in axes3d From: - 2007-01-12 10:17:38 ```Hi all I am trying to plot the trajectory of the Lorenz system with the axes3d.py module (version 0.87.7). The code is the following: from numpy import * from scipy.integrate import odeint import pylab as p import matplotlib.axes3d as p3 def Lorenz(w, t, s, r, b): x, y, z = w return array([s*(y-x), r*x-y-x*z, x*y-b*z]) # Parameters s = 8.0 r = 28.1 b = 8/3.0 w_0 = array([0., 0.8, 0.]) # Initial condition time = arange(0., 100., 0.01) # time vector trajectory = odeint(Lorenz, w_0, time, args=(s, r, b)) # 10^5 x 3 array # There must be better ways to do this: x = trajectory[:,0] y = trajectory[:,1] z = trajectory[:,2] # 3D plotting fig=p.figure() ax = p3.Axes3D(fig) ax.plot3D(x,y,z) # I guess this is the method to use p.show() I get however some errors related with the autoscale_view() method (see below). I have two questions: Is plot3D the correct choice for plotting a 3D curve? In that case, is there any way to fix these errors? Thanks a lot for your help and for making matplotlib possible, dani Errors (pdb output): lorenz.py ---> 42 plot3D(x,y,z) /usr/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] /usr/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 TypeError: autoscale_view() got an unexpected keyword argument 'scalex' > /usr/lib/python2.4/site-packages/matplotlib/axes.py(2131)plot() 2130 -> 2131 self.autoscale_view(scalex=scalex, scaley=scaley) 2132 return lines ```

 [Matplotlib-users] 3D curve and errors in axes3d From: - 2007-01-12 10:17:38 ```Hi all I am trying to plot the trajectory of the Lorenz system with the axes3d.py module (version 0.87.7). The code is the following: from numpy import * from scipy.integrate import odeint import pylab as p import matplotlib.axes3d as p3 def Lorenz(w, t, s, r, b): x, y, z = w return array([s*(y-x), r*x-y-x*z, x*y-b*z]) # Parameters s = 8.0 r = 28.1 b = 8/3.0 w_0 = array([0., 0.8, 0.]) # Initial condition time = arange(0., 100., 0.01) # time vector trajectory = odeint(Lorenz, w_0, time, args=(s, r, b)) # 10^5 x 3 array # There must be better ways to do this: x = trajectory[:,0] y = trajectory[:,1] z = trajectory[:,2] # 3D plotting fig=p.figure() ax = p3.Axes3D(fig) ax.plot3D(x,y,z) # I guess this is the method to use p.show() I get however some errors related with the autoscale_view() method (see below). I have two questions: Is plot3D the correct choice for plotting a 3D curve? In that case, is there any way to fix these errors? Thanks a lot for your help and for making matplotlib possible, dani Errors (pdb output): lorenz.py ---> 42 plot3D(x,y,z) /usr/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] /usr/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 TypeError: autoscale_view() got an unexpected keyword argument 'scalex' > /usr/lib/python2.4/site-packages/matplotlib/axes.py(2131)plot() 2130 -> 2131 self.autoscale_view(scalex=scalex, scaley=scaley) 2132 return lines ```
 Re: [Matplotlib-users] 3D curve and errors in axes3d From: Karol Tarcak - 2007-01-20 19:57:13 ```Hi, the same problem occurred, when I also tried to plot some chaos systems the solution I found (and works just fine) is to comment axes.py:2131 I didn't send a patch, 'cos I'm not sure that it wasn't really an common bug (I played with my overall python distribution) some OT: 1) trajectories -> you could use pydoc numpy.hsplit 2) IMHO to plot chaotic behaviour with iterations over 500k the matplotli= b on an ordinary computer is a little bit slow compared to creating a data file and using gnuplot ... Karol On Fri, Jan 12, 2007 at 11:17:30AM +0100, Mico Fil=F3s wrote: > Hi all >=20 > I am trying to plot the trajectory of the Lorenz system with the axes3d= .py > module (version 0.87.7). The code is the following: >=20 ... >=20 > I get however some errors related with the autoscale_view() method (see= below). > I have two questions: Is plot3D the correct choice for plotting a 3D > curve? In that case, is there any way to fix these errors? >=20 > Thanks a lot for your help and for making matplotlib possible, >=20 > dani >=20 > Errors (pdb output): >=20 > lorenz.py > ---> 42 plot3D(x,y,z) >=20 > /usr/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 =3D self.has_data() > --> 490 lines =3D Axes.plot(self, xs,ys, *args, **kwargs) > 491 if len(lines)=3D=3D1: > 492 line =3D lines[0] >=20 > /usr/lib/python2.4/site-packages/matplotlib/axes.py in plot(self, > *args, **kwargs) > 2129 lines =3D [line for line in lines] # consume the genera= tor > 2130 > -> 2131 self.autoscale_view(scalex=3Dscalex, scaley=3Dscaley) > 2132 return lines >=20 > TypeError: autoscale_view() got an unexpected keyword argument 'scalex' > > /usr/lib/python2.4/site-packages/matplotlib/axes.py(2131)plot() > 2130 > -> 2131 self.autoscale_view(scalex=3Dscalex, scaley=3Dscaley) > 2132 return lines >=20 ```