Add x labels to bar chart
This commit is contained in:
parent
49fe263577
commit
cd9a831067
1 changed files with 5 additions and 1 deletions
6
smem
6
smem
|
|
@ -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()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue