From cb4fc4d5a57e4d54ec3c402886c0a031dc40faf3 Mon Sep 17 00:00:00 2001
From: Holden Rohrer
Date: Sun, 12 Jan 2020 00:02:31 -0500
Subject: udpated data.py to fix a couple of graph construction bugs
---
data.py | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/data.py b/data.py
index 3884910..93d874d 100644
--- a/data.py
+++ b/data.py
@@ -134,17 +134,20 @@ elif arg == 'nei':
plt.ylabel('Nearest Neighbor for Individual Pits (cm)')
plt.plot(x, y, 'bo')
plt.plot(x, np.poly1d(np.polyfit(x, y, 1))(x))
- plt.savefig('nearest_neighbor.png', bbox='tight')
+ plt.savefig('nearest_neighbor.png', bbox_size='tight')
elif arg == 'depwid':
+ depths, widths = [], []
for trial in trials:
size = math.sqrt(trial.size[0]*trial.size[1])
for pit in trial.pits:
- plt.plot(size, pit.depth, 'bo', label='depth')
- plt.plot(size, pit.diam, 'ro', label='width')
+ depths.append((size,pit.depth))
+ widths.append((size,pit.diam))
+ plt.plot([depth[0] for depth in depths], [depth[1] for depth in depths], 'bo', label='depth')
+ plt.plot([width[0] for width in widths], [width[1] for width in widths], 'ro', label='width')
plt.xlabel('Square root of Trial Area (cm)')
plt.ylabel('Depth/Width of Antlion Pits (cm)')
plt.legend(loc='upper right')
- plt.savefig('depth_width.png', bbox='tight')
+ plt.savefig('depth_width.png', bbox_size='tight')
if arg == 'table':
print('Dimensions (in)\tPit Depth (cm)\tPit Width (cm)\tNearest Neighbor (cm)')
for trial in trials:
--
cgit