better colors for barcharts

util/stats/barchart.py:
    If there are fewer than 5 colors, pick from a subset of
    5 so there is more consistency in colors between graphs

--HG--
extra : convert_revision : 6cf64c2f8ed81e714e24a3ebe5a7a60ca168b231
This commit is contained in:
Nathan Binkert 2006-02-25 23:48:13 -05:00
parent 63db9860cf
commit 46189e9e2b

View file

@ -47,7 +47,10 @@ class BarChart(ChartOptions):
cmap = matplotlib.cm.get_cmap(self.colormap) cmap = matplotlib.cm.get_cmap(self.colormap)
if count == 1: if count == 1:
return cmap([ 0.5 ]) return cmap([ 0.5 ])
else:
if count < 5:
return cmap(arange(5) / float(4))[:count]
return cmap(arange(count) / float(count - 1)) return cmap(arange(count) / float(count - 1))
# The input data format does not match the data format that the # The input data format does not match the data format that the