code: def repel_text_from_bboxes(
      add_bboxes,
      texts,
      renderer=None,
      ax=None,
      expand=(1.2, 1.2),
      only_use_max_min=False,
      move=False,
  ):
      """
      Repel texts from other objects' bboxes while expanding their (texts')
      bounding boxes by expand (x, y), e.g. (1.2, 1.2) would multiply width and
      height by 1.2.
      Requires a renderer to get the actual sizes of the text, and to that end
      either one needs to be directly provided, or the axes have to be specified,
      and the renderer is then got from the axes object.
      """
      if ax is None:
          ax = plt.gca()
      if renderer is None:
          r = get_renderer(ax.get_figure())
      else:
          r = renderer
  
      bboxes = get_bboxes(texts, r, expand, ax=ax)
  
      overlaps_x = np.zeros((len(bboxes), len(add_bboxes)))
      overlaps_y = np.zeros_like(overlaps_x)
      overlap_directions_x = np.zeros_like(overlaps_x)
      overlap_directions_y = np.zeros_like(overlaps_y)
  
      for i, bbox1 in enumerate(bboxes):
          for j, bbox2 in enumerate(add_bboxes):
              try:
                  x, y = bbox1.intersection(bbox1, bbox2).size
                  direction = np.sign(bbox1.extents - bbox2.extents)[:2]
                  overlaps_x[i, j] = x
                  overlaps_y[i, j] = y
                  overlap_directions_x[i, j] = direction[0]
                  overlap_directions_y[i, j] = direction[1]
              except AttributeError:
                  pass
  
      move_x = overlaps_x * overlap_directions_x
      move_y = overlaps_y * overlap_directions_y
  
      delta_x = move_x.sum(axis=1)
      delta_y = move_y.sum(axis=1)
  
      q = np.sum(overlaps_x), np.sum(overlaps_y)
      if move:
          move_texts(texts, delta_x, delta_y, bboxes, ax=ax)
      return delta_x, delta_y, q
  
imports: from __future__ import division
  import sys
  from itertools import product
  from operator import itemgetter
  import matplotlib
  import numpy
  from matplotlib import pyplot
  from matplotlib.path import get_path_collection_extents
label_desc: Use image node_id 11 for calling a global function with example usage: repel_text_from_bboxes(add_bboxes, texts, renderer, ax, expand, only_use_max_min, move) and returns: delta_x,  delta_y,  q