summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2013-08-14 02:01:08 -0300
committerLucas De Marchi <lucas.demarchi@intel.com>2013-09-20 14:35:52 -0500
commit7862f1158b17e2084ce2450a3f8d88a3c8d75d31 (patch)
tree6441327f84fc3e1ed715af88597248037716859a
parent68882b4861e182bcfe7af092ba2f6d822c611968 (diff)
downloadkmod-7862f1158b17e2084ce2450a3f8d88a3c8d75d31.tar.gz
scripts/parse-depmod: use anchored text
-rwxr-xr-xscripts/parse-depmod22
1 files changed, 14 insertions, 8 deletions
diff --git a/scripts/parse-depmod b/scripts/parse-depmod
index 87cd31c..3ff8a8b 100755
--- a/scripts/parse-depmod
+++ b/scripts/parse-depmod
@@ -22,8 +22,19 @@ def parse_table(f):
y += [v[1]]
return x, y
-import matplotlib.pyplot as plt
import numpy as np
+import matplotlib.pyplot as plt
+from mpl_toolkits.axes_grid.anchored_artists import AnchoredText
+
+
+def add_at(ax, t, loc=2):
+ fp = dict(size=9)
+ _at = AnchoredText(t, loc=loc, prop=fp)
+ _at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2")
+ _at.patch.set_alpha(0.8)
+ _at.patch.set_fc('#A9A9A9')
+ ax.add_artist(_at)
+ return _at
fig = plt.figure()
@@ -33,17 +44,12 @@ with open(sys.argv[1]) as f:
fit = np.polyfit(x, y, 1)
fit_fn = np.poly1d(fit)
- ax = fig.add_subplot(2, 2, i)
+ 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')
- ax.text(0.03, 0.97,
- 'mean=%.2f\nstddev=%.2f' % (np.mean(y), np.std(y)),
- transform=ax.transAxes,
- verticalalignment='top',
- horizontalalignment='left'
- )
+ 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')