|
9 | 9 | from pandas.core.dtypes.common import is_list_like
|
10 | 10 | from pandas.core.dtypes.generic import ABCDataFrame, ABCIndexClass, ABCSeries
|
11 | 11 |
|
| 12 | +from pandas.plotting._matplotlib import compat |
| 13 | + |
12 | 14 |
|
13 | 15 | def format_date_labels(ax, rot):
|
14 | 16 | # mini version of autofmt_xdate
|
@@ -288,20 +290,26 @@ def _remove_labels_from_axis(axis):
|
288 | 290 |
|
289 | 291 | def _handle_shared_axes(axarr, nplots, naxes, nrows, ncols, sharex, sharey):
|
290 | 292 | if nplots > 1:
|
| 293 | + if compat._mpl_ge_3_2_0(): |
| 294 | + row_num = lambda x: x.get_subplotspec().rowspan.start |
| 295 | + col_num = lambda x: x.get_subplotspec().colspan.start |
| 296 | + else: |
| 297 | + row_num = lambda x: x.rowNum |
| 298 | + col_num = lambda x: x.colNum |
291 | 299 |
|
292 | 300 | if nrows > 1:
|
293 | 301 | try:
|
294 | 302 | # first find out the ax layout,
|
295 | 303 | # so that we can correctly handle 'gaps"
|
296 | 304 | layout = np.zeros((nrows + 1, ncols + 1), dtype=np.bool)
|
297 | 305 | for ax in axarr:
|
298 |
| - layout[ax.rowNum, ax.colNum] = ax.get_visible() |
| 306 | + layout[row_num(ax), col_num(ax)] = ax.get_visible() |
299 | 307 |
|
300 | 308 | for ax in axarr:
|
301 | 309 | # only the last row of subplots should get x labels -> all
|
302 | 310 | # other off layout handles the case that the subplot is
|
303 | 311 | # the last in the column, because below is no subplot/gap.
|
304 |
| - if not layout[ax.rowNum + 1, ax.colNum]: |
| 312 | + if not layout[row_num(ax) + 1, col_num(ax)]: |
305 | 313 | continue
|
306 | 314 | if sharex or len(ax.get_shared_x_axes().get_siblings(ax)) > 1:
|
307 | 315 | _remove_labels_from_axis(ax.xaxis)
|
|
0 commit comments