code: def _adjust_alignment(self, annotation):
          
          try:
              # annotation.xytext is depreciated in recent versions
              dx, dy = annotation.xyann
          except AttributeError:
              # but xyann doesn't exist in older versions...
              dx, dy = annotation.xytext
  
          horizontal = {1:'left', 0:'center', -1:'right'}[np.sign(dx)]
          vertical = {1:'bottom', 0:'center', -1:'top'}[np.sign(dy)]
          if not self._user_set_ha:
              annotation.set_horizontalalignment(horizontal)
          if not self._user_set_va:
              annotation.set_verticalalignment(vertical)
docs: Make text alignment match the specified offsets (this allows easier
          changing of relative position of text box...)