parse-depmod: Allow to plot all at once
This commit is contained in:
parent
003cd0020d
commit
3cdd70349e
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import os.path
|
||||||
|
|
||||||
def parse_table(f):
|
def parse_table(f):
|
||||||
curr = 0
|
curr = 0
|
||||||
|
@ -36,23 +36,31 @@ def add_at(ax, t, loc=2):
|
||||||
ax.add_artist(_at)
|
ax.add_artist(_at)
|
||||||
return _at
|
return _at
|
||||||
|
|
||||||
fig = plt.figure()
|
|
||||||
|
|
||||||
with open(sys.argv[1]) as f:
|
figs = []
|
||||||
for i in range(0, 3):
|
for fn in sys.argv[1:]:
|
||||||
x, y = parse_table(f)
|
fig = plt.figure()
|
||||||
fit = np.polyfit(x, y, 1)
|
figs += [fig]
|
||||||
fit_fn = np.poly1d(fit)
|
|
||||||
|
with open(fn) as f:
|
||||||
|
for i in range(0, 3):
|
||||||
|
x, y = parse_table(f)
|
||||||
|
fit = np.polyfit(x, y, 1)
|
||||||
|
fit_fn = np.poly1d(fit)
|
||||||
|
|
||||||
|
ax = fig.add_subplot(2, 2, i, axisbg='#f6f6f6')
|
||||||
|
ax.plot(x, y, 'b', x, fit_fn(x), 'r')
|
||||||
|
ax.set_xlabel('bucket')
|
||||||
|
ax.set_ylabel('entries')
|
||||||
|
ax.axis('tight')
|
||||||
|
add_at(ax, 'mean=%.2f\nstddev=%.2f' % (np.mean(y), np.std(y)))
|
||||||
|
ax.grid(True)
|
||||||
|
|
||||||
|
tit = os.path.splitext(os.path.basename(fn))[0]
|
||||||
|
fig.suptitle('Hash distribution on buckets: %s' % tit, weight='bold',
|
||||||
|
size='large')
|
||||||
|
fig.tight_layout()
|
||||||
|
fig.subplots_adjust(top=0.9)
|
||||||
|
|
||||||
ax = fig.add_subplot(2, 2, i, axisbg='#f6f6f6')
|
|
||||||
ax.plot(x, y, 'b', x, fit_fn(x), 'r')
|
|
||||||
ax.set_xlabel('bucket')
|
|
||||||
ax.set_ylabel('entries')
|
|
||||||
ax.axis('tight')
|
|
||||||
add_at(ax, 'mean=%.2f\nstddev=%.2f' % (np.mean(y), np.std(y)))
|
|
||||||
ax.grid(True)
|
|
||||||
|
|
||||||
fig.suptitle('Hash distribution on buckets', weight='bold', size='large')
|
|
||||||
fig.tight_layout()
|
|
||||||
plt.subplots_adjust(top=0.9)
|
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
Loading…
Reference in New Issue