title: hist2D masked array - ValueError: cannot convert float NaN to integer
body: <p>Something about the way I have masked zero values in my array is causing an error when doing his2d. I try:</p>
  
  <pre><code>x = ma.masked_array([0.17478785046728973, 0.21854713940370668, 0.7354304690743048,
                       1.1052309124767226, 0.3450562200956937, 0])
  
  x[5] = ma.masked_all(1)
  
  y = ma.masked_array([0.17478785046728973, 0.21854713940370668, 0.7354304690743048,
                       1.1052309124767226, 0.3450562200956937, 0])
  
  plt.hist2d(x, y, bins = 10)
  plt.show()
  </code></pre>
  
  <p>I think it doesn't like something to do with the decimals because this is the error:</p>
  
  <pre><code>---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-82-38bb844ac43e&gt; in &lt;module&gt;()
        9                      1.1052309124767226, 0.3450562200956937, 0])
       10 
  ---&gt; 11 plt.hist2d(c, d, bins = 10)
       12 plt.show()
  
  /Users/eebp/anaconda/envs/Python2/lib/python2.7/site-packages/matplotlib/pyplot.pyc in hist2d(x, y, bins, range, normed, weights, cmin, cmax, hold, data, **kwargs)
     2983         ret = ax.hist2d(x, y, bins=bins, range=range, normed=normed,
     2984                         weights=weights, cmin=cmin, cmax=cmax, data=data,
  -&gt; 2985                         **kwargs)
     2986     finally:
     2987         ax.hold(washold)
  
  /Users/eebp/anaconda/envs/Python2/lib/python2.7/site-packages/matplotlib/__init__.pyc in inner(ax, *args, **kwargs)
     1817                     warnings.warn(msg % (label_namer, func.__name__),
     1818                                   RuntimeWarning, stacklevel=2)
  -&gt; 1819             return func(ax, *args, **kwargs)
     1820         pre_doc = inner.__doc__
     1821         if pre_doc is None:
  
  /Users/eebp/anaconda/envs/Python2/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in hist2d(self, x, y, bins, range, normed, weights, cmin, cmax, **kwargs)
     6300         range = __builtins__["range"]
     6301         h, xedges, yedges = np.histogram2d(x, y, bins=bins, range=bin_range,
  -&gt; 6302                                            normed=normed, weights=weights)
     6303 
     6304         if cmin is not None:
  
  /Users/eebp/anaconda/envs/Python2/lib/python2.7/site-packages/numpy/lib/twodim_base.pyc in histogram2d(x, y, bins, range, normed, weights)
      712         xedges = yedges = asarray(bins, float)
      713         bins = [xedges, yedges]
  --&gt; 714     hist, edges = histogramdd([x, y], bins, range, normed, weights)
      715     return hist, edges[0], edges[1]
      716 
  
  /Users/eebp/anaconda/envs/Python2/lib/python2.7/site-packages/numpy/lib/function_base.pyc in histogramdd(sample, bins, range, normed, weights)
      800         mindiff = dedges[i].min()
      801         if not np.isinf(mindiff):
  --&gt; 802             decimal = int(-log10(mindiff)) + 6
      803             # Find which points are on the rightmost edge.
      804             not_smaller_than_edge = (sample[:, i] &gt;= edges[i][-1])
  
  ValueError: cannot convert float NaN to integer
  </code></pre>
  
  <p>if I plot the array without my masked value against itself: <code>plt.hist2d(y, y, bins = 10)</code> then it <em>works</em>. Am I using the wrong method to mask? I was originally using that syntax to mask a 2D slice of a 3D array, so I am wondering if I am creating an array within an array unnecessarily. </p>