Commit d1a31a8b authored by Jerome Touvier's avatar Jerome Touvier
Browse files

change xaxis date format

parent 9dd795b3
......@@ -558,7 +558,7 @@ def date_format_hours(x, pos=None):
"""See date_format_days function
Only the first tick contains the full date.
"""
fmt = "%D %H:%M:%S" if pos == 1 else "%H:%M:%S"
fmt = "%Y-%m-%d %H:%M:%S" if pos == 1 else "%H:%M:%S"
return datetime.utcfromtimestamp(x).strftime(fmt)
......@@ -570,7 +570,7 @@ def date_format_days(x, pos=None):
:returns: a string containing the corresponding tick label
"""
return datetime.utcfromtimestamp(x).strftime("%D %H:%M:%S")
return datetime.utcfromtimestamp(x).strftime("%Y-%m-%d %H:%M:%S")
def get_units(params, plot_channel):
......@@ -676,9 +676,12 @@ def static_plots(params, st):
ax.set_xlim(left, right)
if not params["spectrum"]:
ax.xaxis.set_major_formatter(FuncFormatter(date_format_hours))
if params["end"].day - params["start"].day >= 1:
day1 = datetime.utcfromtimestamp(left).day
day2 = datetime.utcfromtimestamp(right).day
if day1 != day2:
ax.xaxis.set_major_formatter(FuncFormatter(date_format_days))
else:
ax.xaxis.set_major_formatter(FuncFormatter(date_format_hours))
if params["showtitle"]:
text = (
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment