code: def _split_rect(
      x, y, width, height, proportion, horizontal=True, gap=0.05
  ):
      """
      Split the given rectangle in n segments whose proportion is specified
      along the given axis if a gap is inserted, they will be separated by a
      certain amount of space, retaining the relative proportion between them
      a gap of 1 correspond to a plot that is half void and the remaining half
      space is proportionally divided among the pieces.
      """
      x, y, w, h = float(x), float(y), float(width), float(height)
      if (w < 0) or (h < 0):
          raise ValueError(
              "dimension of the square less than"
              "zero w={} h=()".format(w, h)
          )
      proportions = _normalize_split(proportion)
  
      # extract the starting point and the dimension of each subdivision
      # in respect to the unit square
      starting = proportions[:-1]
      amplitude = proportions[1:] - starting
  
      # how much each extrema is going to be displaced due to gaps
      starting += gap * np.arange(len(proportions) - 1)
  
      # how much the squares plus the gaps are extended
      extension = starting[-1] + amplitude[-1] - starting[0]
  
      # normalize everything for fit again in the original dimension
      starting /= extension
      amplitude /= extension
  
      # bring everything to the original square
      starting = (x if horizontal else y) + starting * (
          w if horizontal else h
      )
      amplitude = amplitude * (w if horizontal else h)
  
      # create each 4-tuple for each new block
      results = [
          (s, y, a, h) if horizontal else (x, s, w, a)
          for s, a in zip(starting, amplitude)
      ]
      return results
  
imports: from statsmodels.compat.python import lrange, lzip
  from itertools import product
  import numpy
  from numpy import array, cumsum, iterable, r_
  from pandas import DataFrame
  from statsmodels.graphics import utils
label_desc: Use image node_id 2 for calling a global function with example usage: _split_rect(x, y, width, height, proportion, horizontal, gap) and returns: results