Skip to content

Pandas stopped working with matplotlib inset-axis #10407

Closed
@floriangeigl

Description

@floriangeigl

Hy,

in older versions pandas was able to plot onto inset-axis of matplotlib. In new versions this support seems to be broken. I was able to execute the following code without any exceptions using an old pandas version. However, the current pandas version (0.16.2) throws an exception. Since the last update of matplotlib is a while back, I think the bug is caused by a recent pandas update. (As far as i remember, I was able to plot onto inset-axis using pandas 0.16.0.)

import matplotlib.pylab as plt
import pandas as pd
from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes

df = pd.DataFrame(range(10))
ax = df.plot() # OK
axins = zoomed_inset_axes(ax, 2)
df.plot(ax=axins) # Throws exception

The thrown exception:

/usr/local/lib/python2.7/dist-packages/pandas/tools/plotting.pyc in _handle_shared_axes(axarr, nplots, naxes, nrows, ncols, sharex, sharey)
   3324         layout = np.zeros((nrows+1,ncols+1), dtype=np.bool)
   3325         for ax in axarr:
-> 3326             layout[ax.rowNum, ax.colNum] = ax.get_visible()
   3327 
   3328         if sharex and nrows > 1:

AttributeError: 'Axes' object has no attribute 'rowNum'

Output of pd.show_version():

INSTALLED VERSIONS

commit: None
python: 2.7.6.final.0
python-bits: 64
OS: Linux
OS-release: 3.13.0-53-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.16.2
nose: 1.3.7
Cython: None
numpy: 1.9.2
scipy: 0.15.1
statsmodels: 0.6.1
IPython: 3.2.0
sphinx: 1.2.2
patsy: 0.3.0
dateutil: 2.4.2
pytz: 2015.4
bottleneck: None
tables: 3.2.0
numexpr: 2.4.3
matplotlib: 1.4.3
openpyxl: 2.0.5
xlrd: 0.9.3
xlwt: 0.7.5
xlsxwriter: None
lxml: 3.3.3
bs4: 4.3.2
html5lib: 0.99999
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: 0.6.2.None
psycopg2: None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions