From cd9a831067e72d27cff6d0b76628d1fc37abebd3 Mon Sep 17 00:00:00 2001 From: Matt Mackall Date: Tue, 7 Apr 2009 15:10:28 -0700 Subject: [PATCH] Add x labels to bar chart --- smem | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/smem b/smem index 4eaa884..1a67c6e 100755 --- a/smem +++ b/smem @@ -407,6 +407,8 @@ def showtable(rows, fields, columns, sort): if options.pie: columns.append(options.pie) + if options.bar: + columns.append(options.bar) for n in columns: if n not in fields: @@ -509,7 +511,7 @@ def showbar(l, columns, sort): rc = [] key = [] - for n in range(len(columns)): + for n in range(len(columns) - 1): try: if columns[n] in 'pid user group'.split(): continue @@ -532,6 +534,8 @@ def showbar(l, columns, sort): [x[1][rc[n]] for x in l], width, color=gc(n))) #plt.xticks(ind + .5, ) + pylab.gca().set_xticks(ind + .5) + pylab.gca().set_xticklabels([x[1][-1] for x in l], rotation=90) pylab.legend([p[0] for p in pl], key) pylab.show()