aboutsummaryrefslogtreecommitdiff
path: root/trappy/plot_utils.py
diff options
context:
space:
mode:
authorJavi Merino <javi.merino@arm.com>2016-01-05 14:47:07 +0000
committerJavi Merino <javi.merino@arm.com>2016-01-05 19:05:49 +0000
commit94d89c1b3c8aa29038731aade64b7a840622690f (patch)
tree241587293722bc23c986e316b1e30fd45d6f137b /trappy/plot_utils.py
parentab94dac062ed58f03b1728a2857fa1563ed1e900 (diff)
downloadtrappy-94d89c1b3c8aa29038731aade64b7a840622690f.tar.gz
plot_utils: fix plot_allfreqs() for one actor
When the system has only one actor and you use trappy.summary_plots() or trappy.compare_runs() you get: Traceback (most recent call last): File "trappy/tests/test_trappy.py", line 127, in test_summary_plots_one_actor trappy.summary_plots(self.actor_order, map_label) File "trappy/trappy/compare_runs.py", line 96, in summary_plots return compare_runs(actor_order, map_label, [(title, path)], **kwords) File "trappy/trappy/compare_runs.py", line 78, in compare_runs trappy.plot_utils.plot_allfreqs(run_data, map_label, **kwords) File "trappy/trappy/plot_utils.py", line 209, in plot_allfreqs run.plot_allfreqs(map_label, ax=ax) File "trappy/trappy/ftrace.py", line 531, in plot_allfreqs for this_ax, (label, dfr) in zip(ax, all_freqs): TypeError: zip argument #1 must support iteration This is because plt.subplots() returns just the axis if ncols and nrows are both 1, a 1D array if either ncols or nrows is 1 and a 2D array otherwise. plot_utils.plot_all_freqs() copes with ncols being 1 but not with nrows being 1. The latter happens when you use summary_plots() or compare_runs() and there is only one actor. Fix it so that axis is always a 2D array: the first index is the run and the second the actor.
Diffstat (limited to 'trappy/plot_utils.py')
-rw-r--r--trappy/plot_utils.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/trappy/plot_utils.py b/trappy/plot_utils.py
index c7054ab..4fa0323 100644
--- a/trappy/plot_utils.py
+++ b/trappy/plot_utils.py
@@ -201,7 +201,12 @@ def plot_allfreqs(runs, map_label, width=None, height=None):
ncols=num_runs)
if num_runs == 1:
- axis = [axis]
+ if nrows == 1:
+ axis = [[axis]]
+ else:
+ axis = [axis]
+ elif nrows == 1:
+ axis = [[ax] for ax in axis]
else:
axis = zip(*axis)