code: def _xdate_setter(self, xdate_format='%Y-%m-%d'):
          
  
          if xdate_format:
              # We have to validate xdate_format. If wrong then bail out.
              try:
                  self.autofmt_xdate()
                  datetime.date(2000, 1, 1).strftime(xdate_format)
  
              except ValueError:
                  self.autofmt_xdate()
                  return
  
              self.__axes.xaxis_date()
              formatter = dates.DateFormatter(xdate_format)
              self.__axes.xaxis.set_major_formatter(formatter)
docs: Makes x axis a date axis with auto format
  
          Parameters
          ----------
  
          xdate_format: String
          \tSets date formatting