From 97985da29a56f8bbe0da03ecf35b68ccd40a116f Mon Sep 17 00:00:00 2001 From: Daniel Manson Date: Fri, 11 Sep 2015 17:32:41 +0100 Subject: [PATCH] extra try-catches for issue 10407 --- pandas/tools/plotting.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py index 9eab385a7a2a5..4fb46cf8e0ac6 100644 --- a/pandas/tools/plotting.py +++ b/pandas/tools/plotting.py @@ -3318,25 +3318,31 @@ def _handle_shared_axes(axarr, nplots, naxes, nrows, ncols, sharex, sharey): if sharex or len(ax.get_shared_x_axes().get_siblings(ax)) > 1: _remove_labels_from_axis(ax.xaxis) - except IndexError: + except (IndexError, AttributeError): # if gridspec is used, ax.rowNum and ax.colNum may different # from layout shape. in this case, use last_row logic for ax in axarr: - if ax.is_last_row(): - continue - if sharex or len(ax.get_shared_x_axes().get_siblings(ax)) > 1: - _remove_labels_from_axis(ax.xaxis) + try: + if ax.is_last_row(): + continue + if sharex or len(ax.get_shared_x_axes().get_siblings(ax)) > 1: + _remove_labels_from_axis(ax.xaxis) + except AttributeError: + pass + if ncols > 1: for ax in axarr: # only the first column should get y labels -> set all other to off # as we only have labels in teh first column and we always have a subplot there, # we can skip the layout test - if ax.is_first_col(): - continue - if sharey or len(ax.get_shared_y_axes().get_siblings(ax)) > 1: - _remove_labels_from_axis(ax.yaxis) - + try: + if ax.is_first_col(): + continue + if sharey or len(ax.get_shared_y_axes().get_siblings(ax)) > 1: + _remove_labels_from_axis(ax.yaxis) + except AttributeError: + pass def _flatten(axes):