def to_xaxis(self, value): if self.axis_has_datelocator(self.axes.xaxis): return date2num(value) else: return value