title: matplotlib 3D surface - gaps / holes in surface
body: <p>A grid is interpolated with scipy's <code>griddata()</code> and contains values and NaNs. However, when the grid is plotted with mplot3d's <code>plot_surface()</code> there are gaps in the surface (see upper plot). The lower the view height, the more of such gaps are rendered. When the grid is plotted in 2D with <code>imshow()</code> there are no gaps (see lower plot).</p>
  
  <p>Comparison <code>plot_surface</code> and <code>imshow</code></p>
  
  <p><img src="https://i.stack.imgur.com/rSj0u.png" alt=""></p>
  
  <p>Here is a close-up:</p>
  
  <p><img src="https://i.stack.imgur.com/tsdkh.png" alt=""></p>
  
  <p>I couldn't find an answer to this problem and I am wondering whether this is a known issue.</p>
  
  <p>This small example reproduces the problem: (<a href="https://gist.github.com/anonymous/bf886433298528bfa2f0f80448ddaa6b" rel="nofollow noreferrer">data.txt</a>)</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  from mpl_toolkits.mplot3d import Axes3D
  
  Z = np.loadtxt('data.txt')
  X = np.linspace(0,3,301)
  Y = np.linspace(0,3,301)
  X = np.array([X,]*(301)).transpose()
  Y = np.array([Y,]*(301))
  fig = plt.figure(figsize=(15,15), dpi=100)
  ax = fig.add_subplot(2, 1, 1, projection='3d')
  plt.hold(True)
  ax.view_init(40,300)
  surf = ax.plot_surface(X, Y, Z, cmap='jet', rstride=1, cstride=1, antialiased=False, shade=False, alpha=1.0, linewidth=0, vmin=0.25, vmax=0.35);
  
  ax.invert_yaxis()
  ax.dist = 11
  
  ax = fig.add_subplot(2, 1, 2)
  plt.hold(True)
  plt.imshow(Z, cmap='jet', vmin=0.25, vmax=0.35, origin='lower');
  
  plt.show()
  </code></pre>