code: def add_pin(self, text, location='left', x=None, use_arrow=False,
                  relative_position=None, style=None):
          
          try:
              series = self.plot_series_list[-1]
          except IndexError:
              raise RuntimeError(
                  'First plot a data series, before using this function')
  
          data = series['data']
          series_x, series_y = list(zip(*data))[:2]
  
          if x is not None:
              if self.xmode == 'log':
                  series_x = np.log10(np.array(series_x))
                  xp = np.log10(x)
              else:
                  xp = x
  
              if self.ymode == 'log':
                  series_y = np.log10(np.array(series_y))
                  y = 10 ** np.interp(xp, series_x, series_y)
              else:
                  y = np.interp(xp, series_x, series_y)
          else:
              x, y = series_x, series_y
  
          self.add_pin_at_xy(x, y, text, location, relative_position,
                             use_arrow, style)
docs: Add pin to most recent data series.
  
          The location of the pin is interpolated if necessary, while correcting
          for logarithmic x and/or y axes.
  
          :param text: the text of the pin label.
          :param location: the location of the pin relative to the data
              point.  Any location accepted by TikZ is allowed.
          :type location: string
          :param x: the x location of the data point (in the most recent
              data series) at which to place the label.  This is
              interpolated between the actual data points.  If None, only
              the relative_position parameter is used.
          :param use_arrow: specifies whether to draw an arrow between the
              data point and the pin label text.
          :type use_arrow: boolean
          :param relative_position: location of the data point as a relative
              number between 0 and 1.
          :param style: optional TikZ styles to apply (e.g. 'red').