code: def patch_formatter(formatter, xdates):
      def newcall(self, x, pos=0):
          if False and x < 0:
              raise ValueError(
                  "DateFormatter found a value of x=0, which is "
                  "an illegal date.  This usually occurs because "
                  "you have not informed the axis that it is "
                  "plotting dates, e.g., with ax.xaxis_date()"
              )
  
          x = xdates[int(x)]
          dt = num2date(x, self.tz)
          return self.strftime(dt, self.fmt)
  
      bound_call = newcall.__get__(formatter, formatter.__class__)
      formatter.__call__ = bound_call
  
file_path: backtrader/backtrader/plot/formatters.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import matplotlib.dates
  import matplotlib.ticker
  from ..utils import num2date
label_desc: Use image node_id 2 for calling a global function with example usage: patch_formatter(formatter, xdates) and returns: self