Skip to content

Commit

Permalink
minor: improve X axis tick marks on timeseries plot
Browse files Browse the repository at this point in the history
  • Loading branch information
mperrin committed Mar 28, 2024
1 parent 1d3e016 commit d86dd95
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions webbpsf/trending.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ def wavefront_time_series_plot(opdtable, start_date=None, end_date=None, ymin=0,
'2022-05-23T00:00:00': ('Larger micrometeorite strike on C3', 'red'),
'2022-06-19T18:00:00': ('Coarse move of C3 for astigmatism correction', 'red'),
#'2022-06-27T00:00:00': ('NIRSpec safing, not in thermal control', 'orange'),
'2022-07-12T00:00:00': ('Large outlier tilt event on B5+C5', 'orange')
'2022-07-12T00:00:00': ('Large outlier tilt event on B5+C5', 'orange'),
'2024-02-25T20:00:00': ('Large outlier wing tilt event on -V2 wing', 'orange'),
}

plt.figure(figsize=(16, 12))
Expand Down Expand Up @@ -137,8 +138,13 @@ def wavefront_time_series_plot(opdtable, start_date=None, end_date=None, ymin=0,

ax.set_xlim(start_date.plot_date, end_date.plot_date)

ax.xaxis.set_major_locator(matplotlib.dates.WeekdayLocator(interval=1))
ax.xaxis.set_minor_locator(matplotlib.dates.DayLocator())
if end_date - start_date < 365:
ax.xaxis.set_major_locator(matplotlib.dates.WeekdayLocator(interval=1))
ax.xaxis.set_minor_locator(matplotlib.dates.DayLocator())

Check warning on line 143 in webbpsf/trending.py

View check run for this annotation

Codecov / codecov/patch

webbpsf/trending.py#L141-L143

Added lines #L141 - L143 were not covered by tests
else:
ax.xaxis.set_major_locator(matplotlib.dates.MonthLocator(interval=1))
ax.xaxis.set_minor_locator(matplotlib.dates.WeekdayLocator(interval=1))

Check warning on line 146 in webbpsf/trending.py

View check run for this annotation

Codecov / codecov/patch

webbpsf/trending.py#L145-L146

Added lines #L145 - L146 were not covered by tests

ax.tick_params('x', length=10)
for tick in ax.get_xticklabels():
tick.set_rotation(75)
Expand Down

0 comments on commit d86dd95

Please sign in to comment.