def draw(self, *args, **kwargs): labels = {} for ax in (self.xaxis, self.yaxis): if ax.get_scale() in GPS_SCALES and ax.isDefault_label: labels[ax] = ax.get_label_text() trans = ax.get_transform() epoch = float(trans.get_epoch()) unit = trans.get_unit_name() iso = Time(epoch, format='gps', scale='utc').iso utc = iso.rstrip('0').rstrip('.') ax.set_label_text('Time [{0!s}] from {1!s} UTC ({2!r})'.format( unit, utc, epoch)) try: super().draw(*args, **kwargs) finally: for ax in labels: # reset labels ax.isDefault_label = True
def draw(self, *args, **kwargs): labels = {} for ax in (self.xaxis, self.yaxis): if ax.get_scale() in GPS_SCALES and ax.isDefault_label: labels[ax] = ax.get_label_text() trans = ax.get_transform() epoch = float(trans.get_epoch()) unit = trans.get_unit_name() iso = Time(epoch, format='gps', scale='utc').iso utc = iso.rstrip('0').rstrip('.') ax.set_label_text('Time [{0!s}] from {1!s} UTC ({2!r})'.format( unit, utc, epoch)) try: super(Axes, self).draw(*args, **kwargs) finally: for ax in labels: # reset labels ax.isDefault_label = True