title: Error: _string_to_bool in mplot3d (workaround found)
body: <p>Edit: workaround at the end of this post. </p>
  
  <p>I was trying to run some of the examples provided <a href="http://matplotlib.org/examples/mplot3d/surface3d_demo.html?highlight=codex%2520plot_surface" rel="noreferrer">here</a> and <a href="http://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html" rel="noreferrer">here</a>.</p>
  
  <p>One of these examples was:</p>
  
  <pre><code>from mpl_toolkits.mplot3d import Axes3D
  import matplotlib.pyplot as plt
  import numpy as np
  
  fig = plt.figure()
  ax = fig.add_subplot(111, projection='3d')
  
  u = np.linspace(0, 2 * np.pi, 100)
  v = np.linspace(0, np.pi, 100)
  
  x = 10 * np.outer(np.cos(u), np.sin(v))
  y = 10 * np.outer(np.sin(u), np.sin(v))
  z = 10 * np.outer(np.ones(np.size(u)), np.cos(v))
  ax.plot_surface(x, y, z,  rstride=4, cstride=4, color='b')
  
  plt.show()
  </code></pre>
  
  <p>This gave me the following error: </p>
  
  <pre><code>/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/axes3d.py:842: MatplotlibDeprecationWarning: The set_scale function was deprecated in version 1.3.
    self.zaxis.set_scale('linear')
  Traceback (most recent call last):
    File "/mnt/hgfs/MCLS/postprocessing/surface3d_demo2.py", line 6, in &lt;module&gt;
      ax = fig.add_subplot(111, projection='3d')
    File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.4.x-py2.7-linux-x86_64.egg/matplotlib/figure.py", line 958, in add_subplot
      a = subplot_class_factory(projection_class)(self, *args, **kwargs)
    File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.4.x-py2.7-linux-x86_64.egg/matplotlib/axes/_subplots.py", line 78, in __init__
      self._axes_class.__init__(self, fig, self.figbox, **kwargs)
    File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/axes3d.py", line 78, in __init__
      *args, **kwargs)
    File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.4.x-py2.7-linux-x86_64.egg/matplotlib/axes/_base.py", line 436, in __init__
      self.cla()
    File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/axes3d.py", line 847, in cla
      Axes.cla(self)
    File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.4.x-py2.7-linux-x86_64.egg/matplotlib/axes/_base.py", line 897, in cla
      self.grid(self._gridOn, which=rcParams['axes.grid.which'])
    File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/axes3d.py", line 1057, in grid
      self._draw_grid = maxes._string_to_bool(b)
  AttributeError: 'module' object has no attribute '_string_to_bool'
  </code></pre>
  
  <p>The error is originated from:
          ax = fig.add_subplot(111, projection='3d')</p>
  
  <p>I tried to check and upgrade matplotlib. Running <code>python -c 'import matplotlib; print matplotlib.__version__'</code> gave me <code>1.4.x</code>.</p>
  
  <p>I dived in the underlying code and found this:</p>
  
  <pre><code>def grid(self, b=True, **kwargs):
  '''
  Set / unset 3D grid.
  
  .. note::
      Currently, this function does not behave the same as
      :meth:`matplotlib.axes.Axes.grid`, but it is intended to
      eventually support that behavior.
  
  .. versionchanged :: 1.1.0
      This function was changed, but not tested. Please report any bugs.
  '''
  # TODO: Operate on each axes separately
  if len(kwargs) :
      b = True
  self._draw_grid = maxes._string_to_bool(b)
  </code></pre>
  
  <p>Can anyone give me a suggestion where to go further?</p>
  
  <p>Edit:
  I have found a workaround for this problem. As can be seen from the last error message something went wrong in the <code>_string_to_bool</code> function. Simply add the following line</p>
  
  <pre><code>from matplotlib.cbook import _string_to_bool
  </code></pre>
  
  <p>on top of </p>
  
  <pre><code>/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/axes3d.py 
  </code></pre>
  
  <p>I still get an error message, but at least I get some output.</p>