diff options
author | Holden Rohrer <hr@hrhr.dev> | 2020-01-12 00:02:31 -0500 |
---|---|---|
committer | Holden Rohrer <hr@hrhr.dev> | 2020-01-12 00:02:31 -0500 |
commit | cb4fc4d5a57e4d54ec3c402886c0a031dc40faf3 (patch) | |
tree | 0287f2e68eaad9588eea67e31adee7064c822e08 /data.py | |
parent | ec64d901054cbfb8fcd33cc172fcad1f2d64bc65 (diff) |
udpated data.py to fix a couple of graph construction bugs
Diffstat (limited to 'data.py')
-rw-r--r-- | data.py | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -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: |