From 632132cf127a7d6eb121ea216a8001f354579d72 Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Sun, 10 Jan 2021 21:56:20 -0500 Subject: fixed axes using figsize --- py/boxplot.py | 5 ++++- py/lineplot.py | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'py') diff --git a/py/boxplot.py b/py/boxplot.py index be1c024..2fd093e 100644 --- a/py/boxplot.py +++ b/py/boxplot.py @@ -1,12 +1,15 @@ from data2 import trials import matplotlib.pyplot as plt +from matplotlib.transforms import Bbox + +plt.figure(figsize=(16,9)) vecs = [] names = [] for trial in trials: vecs.append(trial.nearest_neighbor()) names.append(str(trial)) - + plt.boxplot(vecs, labels=names) plt.title('Nearest Neighbor for Each Pit in Different Trials') plt.ylabel('Distance to Nearest Neighbor (cm)') diff --git a/py/lineplot.py b/py/lineplot.py index efe6b67..83a99b6 100644 --- a/py/lineplot.py +++ b/py/lineplot.py @@ -12,7 +12,7 @@ title = {'nn':'Nearest Neighbor', 'wid':'Pit Width', 'dep':'Pit Depth', 'recl':'Reclusive Population', 'dead':'Cannibalized Individuals'} names = [] -ct = 0 +plt.figure(figsize=(16,9)) def addvar(key, data): deps[key][0].append(mean(data)) @@ -29,7 +29,8 @@ for trial in trials: x = arange(len(names)) width = 0.8; -plt.yticks(x,labels=names) +plt.xticks(x,labels=names) +plt.ylabel('Arbitrary Units') print(names,avg) #for var in varlist: @@ -37,7 +38,8 @@ stdscale = 1/2 for ind in range(len(varlist)): var = varlist[ind] div = mean(deps[var][0]) - plt.bar(x-ind*width/len(varlist), [dep/div for dep in deps[var][0]], + plt.bar(x-ind*width/len(varlist)+width/2, + [dep/div for dep in deps[var][0]], yerr=[stdscale*dep/div for dep in deps[var][1]], capsize=6, label=title[var],alpha=0.5, width=width/len(varlist)) #plt.errorbar(names, [dep/div for dep in deps[var][0]], -- cgit