diff --git a/scripts/tsplot b/scripts/tsplot index 4034ead1150a4c5655682e7ccc2c188a6479121e..3207dcb9590977227a0e5007759ac0a7aae74968 100755 --- a/scripts/tsplot +++ b/scripts/tsplot @@ -12,6 +12,7 @@ import logging import matplotlib as M import matplotlib.pyplot as P import numbers +from functools import reduce from distutils.version import LooseVersion from itertools import chain, islice, cycle @@ -289,7 +290,7 @@ class PlotData: if len(set(vs))==1: continue - for i in xrange(n): + for i in range(n): prefix = '' if k=='name' else k+'=' if vs[i] is not None: labels[i] += u', '+k+u'='+unicode(formatter(vs[i])) @@ -323,7 +324,7 @@ def gather_ts_plots(tss, groupby): def make_palette(cm_name, n, cmin=0, cmax=1): smap = M.cm.ScalarMappable(M.colors.Normalize(cmin/float(cmin-cmax),(cmin-1)/float(cmin-cmax)), M.cm.get_cmap(cm_name)) - return [smap.to_rgba((2*i+1)/float(2*n)) for i in xrange(n)] + return [smap.to_rgba((2*i+1)/float(2*n)) for i in range(n)] def round_numeric_(x): # Helper to round numbers in labels @@ -341,7 +342,7 @@ def plot_plots(plot_groups, axis='time', colour_overrides=[], save=None, dpi=Non group_titles = any((g.group_label() for g in plot_groups)) figure = P.figure() - for i in xrange(nplots): + for i in range(nplots): group = plot_groups[i] plot = figure.add_subplot(nplots, 1, i+1) @@ -372,10 +373,10 @@ def plot_plots(plot_groups, axis='time', colour_overrides=[], save=None, dpi=Non # store each series in a slot corresponding to one of the units, # together with a best-effort label - series_by_unit = [[] for i in xrange(len(uniq_units))] + series_by_unit = [[] for i in range(len(uniq_units))] unique_labels = group.unique_labels(formatter=round_numeric_) - for si in xrange(len(group.series)): + for si in range(len(group.series)): s = group.series[si] label = unique_labels[si] try: @@ -393,7 +394,7 @@ def plot_plots(plot_groups, axis='time', colour_overrides=[], save=None, dpi=Non lines = cycle(["-",(0,(3,1))]) first_plot = True - for ui in xrange(len(uniq_units)): + for ui in range(len(uniq_units)): if not first_plot: plot = plot.twinx()