Skip to content

DataFrame.hist() does not get along with matplotlib.pyplot.tight_layout() #9351

@vfilimonov

Description

@vfilimonov

When tight_layout() is called after DataFrame.hist() it raises AttributeError: 'NoneType' object has no attribute 'is_bbox if any of subplots is empty (number of charts with histograms is smaller than number os subplots).

I.e. the following code:

pd.DataFrame({'a':np.random.randn(100),
              'b':np.random.randn(100),
              }).hist()
plt.tight_layout()

works fine, but this code:

pd.DataFrame({'a':np.random.randn(100),
              'b':np.random.randn(100),
              'c':np.random.randn(100),
              }).hist()
plt.tight_layout()

raises AttributeError.

My versions:
pandas: 0.15.2
numpy: 1.9.1
scipy: 0.14.1
IPython: 2.3.1
matplotlib: 1.4.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions