Commit 41013812 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Minor fixes to statistics CLI command.

parent 9efcf332
...@@ -191,7 +191,7 @@ def bar_plot( ...@@ -191,7 +191,7 @@ def bar_plot(
if metric2 is not None: if metric2 is not None:
metric2.agg = agg metric2.agg = agg
fig, ax1 = plt.subplots(figsize=(5, 4), dpi=72) fig, ax1 = plt.subplots(figsize=(7, 4), dpi=72)
x = np.arange(len(x_values)) x = np.arange(len(x_values))
width = 0.8 / 2 width = 0.8 / 2
if metric2 is None: if metric2 is None:
...@@ -218,8 +218,9 @@ def bar_plot( ...@@ -218,8 +218,9 @@ def bar_plot(
metric1.draw_axis(ax1, data, x_values, x - (width / 2), width, 'tab:blue', only=metric2 is None) metric1.draw_axis(ax1, data, x_values, x - (width / 2), width, 'tab:blue', only=metric2 is None)
ax1.set_ylim(**ylim) ax1.set_ylim(**ylim)
ax1.set_yticks([40, 30, 20, 10, 5, 1, 0.5, 0.1]) # ax1.set_yticks([40, 30, 20, 10, 5, 1, 0.5, 0.1])
ax1.grid(which='major', axis='y', linestyle='--') if not metric2:
ax1.grid(which='major', axis='y', linestyle='-')
if metric2: if metric2:
ax2 = ax1.twinx() # instantiate a second axes that shares the same x-axis ax2 = ax1.twinx() # instantiate a second axes that shares the same x-axis
...@@ -328,11 +329,11 @@ def statistics_plot(errors, title, x_axis, y_axis, cumulate, total, save, power, ...@@ -328,11 +329,11 @@ def statistics_plot(errors, title, x_axis, y_axis, cumulate, total, save, power,
kwargs = {} kwargs = {}
if x_axis == 'code': if x_axis == 'code':
x_axis = codes x_axis = codes
kwargs.update(ylim=dict(bottom=0)) kwargs.update(ylim=dict(bottom=1))
elif x_axis == 'time': elif x_axis == 'time':
x_axis = dates x_axis = dates
kwargs.update( kwargs.update(
ylim=dict(bottom=0), ylim=dict(bottom=1),
format_xlabel=lambda x: datetime.fromtimestamp(int(x) / 1000).strftime('%b %y')) format_xlabel=lambda x: datetime.fromtimestamp(int(x) / 1000).strftime('%b %y'))
else: else:
assert False, 'x axis can only be "code" or "time"' assert False, 'x axis can only be "code" or "time"'
......
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