In [6]:
%pylab inline
import pylab as pl
import math
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D



plt.rcParams['legend.fontsize'] = 10

fig = plt.figure()
ax = fig.gca(projection='3d')
theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
z = np.linspace(-2, 2, 100)
r = z**2 + 1
x = r * np.sin(theta)
y = r * np.cos(theta)
ax.plot(x, y, z, label='parametric curve')
ax.legend()

plt.show()


Populating the interactive namespace from numpy and matplotlib
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-6-e3b47e10f618> in <module>()
     11 
     12 fig = plt.figure()
---> 13 ax = fig.gca(projection='3d')
     14 theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
     15 z = np.linspace(-2, 2, 100)

//Applications/paraview.app/Contents/Python/matplotlib/figure.pyc in gca(self, **kwargs)
   1064             if isinstance(ax, projection_class):
   1065                 return ax
-> 1066         return self.add_subplot(111, **kwargs)
   1067 
   1068     def sca(self, a):

//Applications/paraview.app/Contents/Python/matplotlib/figure.pyc in add_subplot(self, *args, **kwargs)
    787                     # more similar to add_axes.
    788 
--> 789             a = subplot_class_factory(projection_class)(self, *args, **kwargs)
    790         self._axstack.add(key, a)
    791         self.sca(a)

//Applications/paraview.app/Contents/Python/matplotlib/axes.pyc in __init__(self, fig, *args, **kwargs)
   8455 
   8456         # _axes_class is set in the subplot_class_factory
-> 8457         self._axes_class.__init__(self, fig, self.figbox, **kwargs)
   8458 
   8459 

/Users/andrei/Documents/zPost/zpost-py27/lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyc in __init__(self, fig, rect, *args, **kwargs)
     95         Axes.__init__(self, fig, rect,
     96                       frameon=True,
---> 97                       *args, **kwargs)
     98         # Disable drawing of axes by base class
     99         Axes.set_axis_off(self)

//Applications/paraview.app/Contents/Python/matplotlib/axes.pyc in __init__(self, fig, rect, axisbg, frameon, sharex, sharey, label, xscale, yscale, **kwargs)
    461         self._hold = rcParams['axes.hold']
    462         self._connected = {} # a dict from events to (id, func)
--> 463         self.cla()
    464         # funcs used to format x and y - fall back on major formatters
    465         self.fmt_xdata = None

/Users/andrei/Documents/zPost/zpost-py27/lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyc in cla(self)
   1044             self.zaxis._set_scale(self._sharez.zaxis.get_scale())
   1045         else:
-> 1046             self.zaxis._set_scale('linear')
   1047 
   1048         self._autoscaleZon = True

AttributeError: 'ZAxis' object has no attribute '_set_scale'
<matplotlib.figure.Figure at 0x10681a050>

In [ ]: