Better axis formatting for single-day plots
This commit is contained in:
parent
01a4cb8feb
commit
4c333281cb
|
@ -161,14 +161,16 @@ print("Formatting...")
|
||||||
|
|
||||||
ax.yaxis_date()
|
ax.yaxis_date()
|
||||||
|
|
||||||
#ax.yaxis.set_major_locator(HourLocator(range(0, 25, 1)))
|
if len(args.input) == 1:
|
||||||
#ax.yaxis.set_minor_locator(MinuteLocator(range(0, 60, 20)))
|
# only one argument means that we plot at most 1 day. Use Hour and Minute
|
||||||
#ax.yaxis.set_major_formatter(DateFormatter('%H:%M'))
|
# locators for nicer formatting.
|
||||||
#ax.yaxis.set_minor_formatter(DateFormatter('%M'))
|
ax.yaxis.set_major_locator(HourLocator(range(0, 25, 1)))
|
||||||
|
ax.yaxis.set_minor_locator(MinuteLocator(range(0, 60, 20)))
|
||||||
#loc = AutoDateLocator()
|
ax.yaxis.set_major_formatter(DateFormatter('%H:%M'))
|
||||||
#ax.yaxis.set_major_locator(loc)
|
ax.yaxis.set_minor_formatter(DateFormatter('%M'))
|
||||||
#ax.yaxis.set_major_formatter(DateFormatter('%Y-%m-%d %H:%M'))
|
else:
|
||||||
|
# we are plotting multiple files and therefore probably a long time. Use
|
||||||
|
# Day and Hour locators.
|
||||||
|
|
||||||
ax.yaxis.set_major_locator(DayLocator(interval=max(1, args.resolution // 600)))
|
ax.yaxis.set_major_locator(DayLocator(interval=max(1, args.resolution // 600)))
|
||||||
ax.yaxis.set_major_formatter(DateFormatter('%Y-%m-%d'))
|
ax.yaxis.set_major_formatter(DateFormatter('%Y-%m-%d'))
|
||||||
|
|
Loading…
Reference in a new issue