code: def _fit_axes(ax):
      """Help for plot_matrix.
  
      This function redimensions the given axes to have
      labels fitting.
      """
      fig = ax.get_figure()
      renderer = fig.canvas.get_renderer()
      ylabel_width = (
          ax.yaxis.get_tightbbox(renderer)
          .transformed(ax.figure.transFigure.inverted())
          .width
      )
      if ax.get_position().xmin < 1.1 * ylabel_width:
          # we need to move it over
          new_position = ax.get_position()
          new_position.x0 = 1.1 * ylabel_width  # pad a little
          ax.set_position(new_position)
  
      xlabel_height = (
          ax.xaxis.get_tightbbox(renderer)
          .transformed(ax.figure.transFigure.inverted())
          .height
      )
      if ax.get_position().ymin < 1.1 * xlabel_height:
          # we need to move it over
          new_position = ax.get_position()
          new_position.y0 = 1.1 * xlabel_height  # pad a little
          ax.set_position(new_position)
  
imports: import warnings
  import matplotlib.patches
  import matplotlib.pyplot
  import numpy
  import pandas
  from mpl_toolkits.axes_grid1 import make_axes_locatable
  from scipy.cluster.hierarchy import leaves_list, linkage, optimal_leaf_ordering
  from nilearn.glm.first_level.experimental_paradigm import check_events
  from .._utils import fill_doc
label_desc: Use image node_id 1 for calling a global function with example usage: _fit_axes(ax) without return types