plot_utils: add a "count" y-label to the histogram plot
Xin was confused about the histogram plot. It doesn't look like an
histogram. Add a Y-label explaining that it is a count. Add support
for y-labels to post_plot_setup() accordingly.
Change-Id: I1be871e89dead9f35996bb89df68e088521c0349
diff --git a/cr2/plot_utils.py b/cr2/plot_utils.py
index 3ae88de..fc01329 100644
--- a/cr2/plot_utils.py
+++ b/cr2/plot_utils.py
@@ -92,8 +92,9 @@
return axis
-def post_plot_setup(ax, title="", xlabel=None, xlim="default", ylim="range"):
- """Set xlabel, title, xlim adn ylim of the plot
+def post_plot_setup(ax, title="", xlabel=None, ylabel=None, xlim="default",
+ ylim="range"):
+ """Set xlabel, ylabel title, xlim and ylim of the plot
This has to be called after calls to .plot(). The default ylim is
to extend it by 10% because matplotlib default makes it hard
@@ -104,6 +105,9 @@
if xlabel is not None:
ax.set_xlabel(xlabel)
+ if ylabel is not None:
+ ax.set_ylabel(ylabel)
+
if title:
ax.set_title(title)
@@ -144,7 +148,8 @@
title += " (mean = {:.2f}, std = {:.2f})".format(mean, std)
data.hist(ax=ax, bins=bins)
- post_plot_setup(ax, title=title, xlabel=xlabel, xlim=xlim, ylim=ylim)
+ post_plot_setup(ax, title=title, xlabel=xlabel, ylabel="count", xlim=xlim,
+ ylim=ylim)
def plot_load(runs, map_label, width=None, height=None):
"""Make a multiplot of all the loads"""