Add x labels to bar chart

This commit is contained in:
Matt Mackall 2009-04-07 15:10:28 -07:00
commit cd9a831067

6
smem
View file

@ -407,6 +407,8 @@ def showtable(rows, fields, columns, sort):
if options.pie: if options.pie:
columns.append(options.pie) columns.append(options.pie)
if options.bar:
columns.append(options.bar)
for n in columns: for n in columns:
if n not in fields: if n not in fields:
@ -509,7 +511,7 @@ def showbar(l, columns, sort):
rc = [] rc = []
key = [] key = []
for n in range(len(columns)): for n in range(len(columns) - 1):
try: try:
if columns[n] in 'pid user group'.split(): if columns[n] in 'pid user group'.split():
continue continue
@ -532,6 +534,8 @@ def showbar(l, columns, sort):
[x[1][rc[n]] for x in l], width, color=gc(n))) [x[1][rc[n]] for x in l], width, color=gc(n)))
#plt.xticks(ind + .5, ) #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.legend([p[0] for p in pl], key)
pylab.show() pylab.show()