title: Seaborn distplot errors when generating histograms for single-element series
body: <p>When I use seaborn's <a href="http://seaborn.pydata.org/generated/seaborn.distplot.html" rel="nofollow noreferrer">distplot</a> (in 0.7.1) to visualize a histogram, I get an error if the input series contains only a single element. In other words, something like</p>
  
  <pre><code>import numpy as np
  import seaborn as sns
  
  num_elements = 1000
  sns.distplot(np.random.normal(10, 1, num_elements))
  </code></pre>
  
  <p>works beautifully but if I set <code>num_elements</code> to 1 I get the following error:</p>
  
  <pre><code>In [8]: num_elements = 1
  
  In [9]: sns.distplot(np.random.normal(10, 1, num_elements))
  ---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-9-35e3f8293582&gt; in &lt;module&gt;()
  ----&gt; 1 sns.distplot(np.random.normal(10, 1, num_elements))
  
  /usr/local/lib/python2.7/site-packages/seaborn/distributions.pyc in distplot(a, bins, hist, kde, rug, fit, hist_kws, kde_kws, rug_kws, fit_kws, color, vertical, norm_hist, axlabel, label, ax)
      207     if hist:
      208         if bins is None:
  --&gt; 209             bins = min(_freedman_diaconis_bins(a), 50)
      210         hist_kws.setdefault("alpha", 0.4)
      211         hist_kws.setdefault("normed", norm_hist)
  
  /usr/local/lib/python2.7/site-packages/seaborn/distributions.pyc in _freedman_diaconis_bins(a)
       28     # From http://stats.stackexchange.com/questions/798/
       29     a = np.asarray(a)
  ---&gt; 30     h = 2 * iqr(a) / (len(a) ** (1 / 3))
       31     # fall back to sqrt(a) bins if iqr is 0
       32     if h == 0:
  
  TypeError: len() of unsized object
  </code></pre>
  
  <p>After poking around the source a bit, I found that I could avoid this error by specifying the number of bins. But that opens me up to another one: </p>
  
  <pre><code>---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-10-6e6569de737a&gt; in &lt;module&gt;()
  ----&gt; 1 sns.distplot(np.random.normal(10, 1, num_elements), bins=10)
  
  /usr/local/lib/python2.7/site-packages/seaborn/distributions.pyc in distplot(a, bins, hist, kde, rug, fit, hist_kws, kde_kws, rug_kws, fit_kws, c\olor, vertical, norm_hist, axlabel, label, ax)
      213         hist_color = hist_kws.pop("color", color)
      214         ax.hist(a, bins, orientation=orientation,
  --&gt; 215                 color=hist_color, **hist_kws)
      216         if hist_color != color:
      217             hist_kws["color"] = hist_color
  
  /usr/local/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:
  
  /usr/local/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in hist(self, x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, **kwargs)
     5933             x = np.array([[]])
     5934         else:
  -&gt; 5935             x = _normalize_input(x, 'x')
     5936         nx = len(x)  # number of datasets
     5937
  
  /usr/local/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in _normalize_input(inp, ename)
     5875                 else:
     5876                     raise ValueError(
  -&gt; 5877                         "{ename} must be 1D or 2D".format(ename=ename))
     5878                 if inp.shape[1] &lt; inp.shape[0]:
     5879                     warnings.warn(
  
  ValueError: x must be 1D or 2D
  </code></pre>
  
  <p>What's going on here? Is there some workaround I can use to force seaborn to plot a histogram for this single element series? For context, I need this because I'm plotting multiple histograms, describing different conditions, on a shared axis. In some cases, there might be only a single element in that condition, yet I ought to be able to plot just the one bar!</p>