@@ -610,9 +610,32 @@ def _plot(self, fig, intervals):
610610 "duration" should be in units of hours.
611611
612612 """
613+ plot_dict = {} if self .plot_dict is None else self .plot_dict
614+
613615 ax = fig .add_axes ([0 , 0 , 1 , 1 ]) # pylint: disable=invalid-name
614- color_mappable = self ._plot_dates (intervals , self .start_date , self .end_date , ax )
615- self ._add_axis_labels (ax , self .plot_dict )
616+ epoch_tstamp = pd .Timestamp (
617+ year = self .start_date .year , month = self .start_date .month , day = self .start_date .day , hour = 0 , tz = "UTC"
618+ )
619+ color_mappable = self ._plot_dates (
620+ intervals , self .start_date , self .end_date , ax , epoch_tstamp = epoch_tstamp
621+ )
622+ self ._add_axis_labels (ax )
623+
624+ if plot_dict ["ylabel" ] == "MJD" :
625+
626+ def ylabel_formatter (days_past_epoch , * args ):
627+ return int (
628+ (epoch_tstamp + pd .to_timedelta (days_past_epoch , unit = "days" )).to_julian_date ()
629+ - 2400000.5
630+ )
631+
632+ else :
633+
634+ def ylabel_formatter (days_past_epoch , * args ):
635+ return (epoch_tstamp + pd .to_timedelta (days_past_epoch , unit = "days" )).strftime ("%Y-%m-%d" )
636+
637+ ax .yaxis .set_major_formatter (mpl .ticker .FuncFormatter (ylabel_formatter ))
638+
616639 return color_mappable , np .array ([ax ])
617640
618641
0 commit comments