diff options
Diffstat (limited to 'python/neighbor.py')
-rw-r--r-- | python/neighbor.py | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/python/neighbor.py b/python/neighbor.py deleted file mode 100644 index 004979a..0000000 --- a/python/neighbor.py +++ /dev/null @@ -1,21 +0,0 @@ -from data import trials -from scipy.stats import pearsonr -from numpy import poly1d, polyfit -from math import sqrt -import matplotlib.pyplot as plt - -x = [] -y = [] -for trial in trials: - size = sqrt(trial.size[0]*trial.size[1]) - nei = trial.nearest_neighbor() - x.append(size) - y.append(sum(nei)/len(nei)) -fig = plt.figure() -ax = fig.add_subplot(111) -plt.text(0.1, 0.9, 'R^2 = %.3f\np=%.3f' % (pearsonr(x,y)[0]**2, pearsonr(x,y)[1]), ha='center', va='center', transform=ax.transAxes) -plt.xlabel('Square root of Trial Area (cm)') -plt.ylabel('Nearest Neighbor for Individual Pits (cm)') -plt.plot(x, y, 'bo') -plt.plot(x, poly1d(polyfit(x, y, 1))(x)) -plt.savefig('nearest_neighbor.png', bbox_inches='tight') |