<h4 dir="auto">Code Sample, a copy-pastable example if possible</h4>
<p dir="auto">First, relevant imports:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import pandas as pd
import numpy as np
import matplotlib.pyplot as plt"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</span>
<span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span></pre></div>
<p dir="auto">This doesn't work:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pd.DataFrame(np.random.randn(100, 3)).hist()
plt.tight_layout()"><pre class="notranslate"><span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randn</span>(<span class="pl-c1">100</span>, <span class="pl-c1">3</span>)).<span class="pl-en">hist</span>()
<span class="pl-s1">plt</span>.<span class="pl-en">tight_layout</span>()</pre></div>
<p dir="auto">It raises the following error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="AttributeError: 'NoneType' object has no attribute 'is_bbox'"><pre class="notranslate"><code class="notranslate">AttributeError: 'NoneType' object has no attribute 'is_bbox'
</code></pre></div>
<p dir="auto">I suppose this happens because it makes 2x2 plot grid but uses only three subplots. If I use all subplots, then it works:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pd.DataFrame(np.random.randn(100, 4)).hist()
plt.tight_layout()"><pre class="notranslate"><span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randn</span>(<span class="pl-c1">100</span>, <span class="pl-c1">4</span>)).<span class="pl-en">hist</span>()
<span class="pl-s1">plt</span>.<span class="pl-en">tight_layout</span>()</pre></div>
<h4 dir="auto">Expected Output</h4>
<p dir="auto">Expected to get tight layout with 2x2 subplot grid.</p>
<p dir="auto">It should be possible to make this work, because the following works with with matplotlib:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="plt.figure()
plt.subplot(2, 2, 1)
plt.plot([1,2,3])
plt.subplot(2, 2, 2)
plt.plot([4,5,6])
plt.subplot(2, 2, 3)
plt.plot([7,8,9])
plt.tight_layout()"><pre class="notranslate"><span class="pl-s1">plt</span>.<span class="pl-en">figure</span>()
<span class="pl-s1">plt</span>.<span class="pl-en">subplot</span>(<span class="pl-c1">2</span>, <span class="pl-c1">2</span>, <span class="pl-c1">1</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">plot</span>([<span class="pl-c1">1</span>,<span class="pl-c1">2</span>,<span class="pl-c1">3</span>])
<span class="pl-s1">plt</span>.<span class="pl-en">subplot</span>(<span class="pl-c1">2</span>, <span class="pl-c1">2</span>, <span class="pl-c1">2</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">plot</span>([<span class="pl-c1">4</span>,<span class="pl-c1">5</span>,<span class="pl-c1">6</span>])
<span class="pl-s1">plt</span>.<span class="pl-en">subplot</span>(<span class="pl-c1">2</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">plot</span>([<span class="pl-c1">7</span>,<span class="pl-c1">8</span>,<span class="pl-c1">9</span>])
<span class="pl-s1">plt</span>.<span class="pl-en">tight_layout</span>()</pre></div>
<h4 dir="auto">output of <code class="notranslate">pd.show_versions()</code></h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="INSTALLED VERSIONS
------------------
commit: None
python: 3.5.1.final.0
python-bits: 64
OS: Linux
OS-release: 4.5.4-gnu-1
machine: x86_64
processor: 
byteorder: little
LC_ALL: None
LANG: en_DK.UTF-8

pandas: 0.18.1
nose: 1.3.7
pip: 8.1.1
setuptools: 20.2.1
Cython: 0.24
numpy: 1.11.0
scipy: 0.17.1
statsmodels: None
xarray: None
IPython: 4.2.0
sphinx: 1.4.2
patsy: None
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: None
tables: None
numexpr: 2.5.2
matplotlib: 1.5.1
openpyxl: None
xlrd: 0.9.4
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.4.1
html5lib: None
httplib2: 0.9.2
apiclient: 1.5.0
sqlalchemy: 1.0.13
pymysql: None
psycopg2: 2.6.1 (dt dec pq3 ext lo64)
jinja2: 2.8
boto: None
pandas_datareader: None"><pre class="notranslate"><code class="notranslate">INSTALLED VERSIONS
------------------
commit: None
python: 3.5.1.final.0
python-bits: 64
OS: Linux
OS-release: 4.5.4-gnu-1
machine: x86_64
processor: 
byteorder: little
LC_ALL: None
LANG: en_DK.UTF-8

pandas: 0.18.1
nose: 1.3.7
pip: 8.1.1
setuptools: 20.2.1
Cython: 0.24
numpy: 1.11.0
scipy: 0.17.1
statsmodels: None
xarray: None
IPython: 4.2.0
sphinx: 1.4.2
patsy: None
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: None
tables: None
numexpr: 2.5.2
matplotlib: 1.5.1
openpyxl: None
xlrd: 0.9.4
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.4.1
html5lib: None
httplib2: 0.9.2
apiclient: 1.5.0
sqlalchemy: 1.0.13
pymysql: None
psycopg2: 2.6.1 (dt dec pq3 ext lo64)
jinja2: 2.8
boto: None
pandas_datareader: None
</code></pre></div>
<p dir="auto">When <code class="notranslate">tight_layout()</code> is called after <code class="notranslate">DataFrame.hist()</code> it raises <code class="notranslate">AttributeError: 'NoneType' object has no attribute 'is_bbox</code> if any of subplots is empty (number of charts with histograms is smaller than number os subplots).</p>
<p dir="auto">I.e. the following code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="pd.DataFrame({'a':np.random.randn(100),
              'b':np.random.randn(100),
              }).hist()
plt.tight_layout()"><pre class="notranslate"><code class="notranslate">pd.DataFrame({'a':np.random.randn(100),
              'b':np.random.randn(100),
              }).hist()
plt.tight_layout()
</code></pre></div>
<p dir="auto">works fine, but this code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="pd.DataFrame({'a':np.random.randn(100),
              'b':np.random.randn(100),
              'c':np.random.randn(100),
              }).hist()
plt.tight_layout()"><pre class="notranslate"><code class="notranslate">pd.DataFrame({'a':np.random.randn(100),
              'b':np.random.randn(100),
              'c':np.random.randn(100),
              }).hist()
plt.tight_layout()
</code></pre></div>
<p dir="auto">raises <code class="notranslate">AttributeError</code>.</p>
<p dir="auto">My versions:<br>
pandas: 0.15.2<br>
numpy: 1.9.1<br>
scipy: 0.14.1<br>
IPython: 2.3.1<br>
matplotlib: 1.4.2</p>