title: pylab.plot "cannot convert float NaN to integer" after calling scipy.stats.multivariate_normal
body: <p>While testing a regression algorithm I found this strange behavior: for some covariance matrices, the multivariate_normal function gives correct samples but then an exception is raised (only) the first time pylab.plot() is called:</p>
  <blockquote>
  <p>ValueError: cannot convert float NaN to integer</p>
  </blockquote>
  <p>The following code reproduces the error:</p>
  <pre><code>import numpy as np
  from scipy.stats import multivariate_normal as mnorm
  from matplotlib import pyplot as plt
  
  B = np.array([ 0, 0, 0])
  
  # works fine
  v1 = np.array([[1, 0, 0],
                [0, 1, 0],
                [0, 0, 1]])
  
  
  # OK. non positive semidefinite, well raised exception
  v2 = np.array([[ 0.2 , -0.2, -0.3],
                [-0.2,  0.4, -0.9],
                [-0.3, -0.9,  0.7]])
  
  # KO. exception (?)
  v3 = np.array([[ 0.2 , -0.02, -0.026],
                [-0.02,  0.014, -0.009],
                [-0.026, -0.009,  0.017]])
  
  
  
  w = mnorm(mean=B, cov=v3).rvs()
  print w
  
  plt.plot(w)
  plt.show()
  </code></pre>
  <p>And if plt.plot(w) is called a second time, then it works. Any ideas?</p>
  <p>Versions:</p>
  <blockquote>
  <p>python 2.7.5 Anaconda 1.9.1 (64-bit)</p>
  <p>scipy 0.14.0</p>
  <p>matplotlib 1.3.1</p>
  <p>numpy 1.8.1</p>
  </blockquote>