code: def _handle_shared_axes(
      axarr, nplots, naxes, nrows, ncols, sharex, sharey
  ):
      if nplots > 1:
          if nrows > 1:
              try:
                  # first find out the ax layout,
                  # so that we can correctly handle 'gaps"
                  layout = np.zeros(
                      (nrows + 1, ncols + 1), dtype=np.bool
                  )
                  for ax in axarr:
                      layout[ax.rowNum, ax.colNum] = ax.get_visible()
  
                  for ax in axarr:
                      # only the last row of subplots should get x labels -> all
                      # other off layout handles the case that the subplot is
                      # the last in the column, because below is no subplot/gap.
                      if not layout[ax.rowNum + 1, ax.colNum]:
                          continue
                      if (
                          sharex
                          or len(
                              ax.get_shared_x_axes().get_siblings(ax)
                          )
                          > 1
                      ):
                          _remove_labels_from_axis(ax.xaxis)
  
              except IndexError:
                  # 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)
  
          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 the 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)
  
file_path: catboost/contrib/python/pandas/py2/pandas/plotting/_tools.py
imports: from __future__ import division
  from math import ceil
  import warnings
  import numpy
  from pandas.compat import range
  from pandas.core.dtypes.common import is_list_like
  from pandas.core.dtypes.generic import ABCDataFrame, ABCIndexClass, ABCSeries
label_desc: Use image node_id 6 for calling a global function with example usage: _handle_shared_axes(axarr, nplots, naxes, nrows, ncols, sharex, sharey) without return types