summaryrefslogtreecommitdiffstats
path: root/data/combined
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2012-03-04 13:01:08 -0800
committerThibaut Horel <thibaut.horel@gmail.com>2012-03-04 13:23:18 -0800
commitd7b0798050f72f08bcb3995c465efeb9bf9f516d (patch)
treed23b2f6d33ee68c585e7a754a78f31bf066eb8a2 /data/combined
parent88f7c5cc1cabcade583c41c55d9df3e5d8cab300 (diff)
downloadkinect-d7b0798050f72f08bcb3995c465efeb9bf9f516d.tar.gz
Set font size, figsize, and bounding box of plots
Started taking Brano's comments into account (section 3)
Diffstat (limited to 'data/combined')
-rwxr-xr-xdata/combined/graphs/plots.py87
1 files changed, 46 insertions, 41 deletions
diff --git a/data/combined/graphs/plots.py b/data/combined/graphs/plots.py
index 98b9bc5..6f37b27 100755
--- a/data/combined/graphs/plots.py
+++ b/data/combined/graphs/plots.py
@@ -6,12 +6,17 @@ import matplotlib.mlab as mlab
import sys
import os
import scipy
+import matplotlib as mpl
+mpl.rcParams['font.size'] = 8
+mpl.rcParams['lines.linewidth'] = 0.5
+mpl.rcParams['figure.figsize'] = 6,5
+mpl.rcParams['legend.fontsize'] = 8
+mpl.rcParams['axes.linewidth'] = 0.8
out_dir = sys.argv[1]
-
#limbs distribution
-plt.cla()
+plt.figure()
data = np.loadtxt("../limbs-avg-zdiff/data.csv",delimiter=",")
data = data[#(data[:,1] == 25)
((data != -1).all(1))
@@ -21,13 +26,13 @@ data = data[:,7:]*100
mean = data.mean(0)
var = data.std(0)
for i in range(len(mean)):
- plt.subplot(3,3,i+1)
- n,b,p = plt.hist(data[:,i],bins=50,normed=1)
+ ax = plt.subplot(2,5,i+1)
+ n,b,p = plt.hist(data[:,i],bins=100,normed=1,linewidth=0)
plt.plot(b,mlab.normpdf(b,mean[i],var[i]))
-plt.savefig(os.path.join(out_dir,"limbs.pdf"))
+plt.savefig(os.path.join(out_dir,"limbs.pdf"),bbox_inches="tight",pad_inches=0.05)
#frames distribution
-plt.cla()
+fig = plt.figure(figsize=(6,4))
x = np.loadtxt("frames.txt",usecols=(0,))
y = range(1,len(x)+1)
width=0.8
@@ -38,88 +43,88 @@ plt.xlabel("Individual")
plt.ylabel("Frame ratio [%]")
plt.ylim(0,17)
ax = plt.gca()
-plt.savefig(os.path.join(out_dir,"frames.pdf"))
+plt.savefig(os.path.join(out_dir,"frames.pdf"),bbox_inches="tight",pad_inches=0.05)
l = ["3","5","10","all"]
#10-fold, naive
-plt.cla()
-#ax = plt.subplot(121)
-plt.axis([0,100,50,100])
-#ax.set_aspect(2)
+plt.figure()
for i in l:
x,y = np.loadtxt(i+"_nb_off.mat",unpack=True)
- plt.plot(100*x,100*y,label="$n_p=$ "+i,linewidth=0.8)
+ plt.plot(100*x,100*y,label="$n_p=$ "+i)
plt.xlabel("Recall [%]")
plt.ylabel("Precision [%]")
plt.legend(loc="best")
-plt.savefig(os.path.join(out_dir,"offline-nb.pdf"))
+plt.axis([0,100,50,100])
+plt.savefig(os.path.join(out_dir,"offline-nb.pdf"),bbox_inches="tight",pad_inches=0.05)
+
#10-fold, SHT
-#ax = plt.subplot(122)
-#plt.axis([0,100,50,100])
-#ax.set_aspect(2)
-plt.cla()
+plt.figure()
for i in l:
x,y = np.loadtxt(i+"_sht_off.mat",unpack=True)
- plt.plot(100*x,100*y,label="$n_p=$ "+i,linewidth=0.8)
+ plt.plot(100*x,100*y,label="$n_p=$ "+i)
plt.xlabel("Recall [%]")
plt.ylabel("Precision [%]")
- plt.legend(loc="best")
-
+ plt.legend(loc="lower left")
plt.axis([0,100,50,100])
-plt.savefig(os.path.join(out_dir,"offline-sht.pdf"))
+plt.savefig(os.path.join(out_dir,"offline-sht.pdf"),bbox_inches="tight",pad_inches=0.05)
#online,NB
-plt.cla()
+plt.figure()
for i in l:
x,y = np.loadtxt(i+"_nb_on.mat",unpack=True)
- plt.plot(100*x,100*y,label="$n_p=$ "+i,linewidth=0.8,markersize=4)
+ plt.plot(100*x,100*y,label="$n_p=$ "+i)
plt.xlabel("Recall [%]")
plt.ylabel("Precision [%]")
plt.legend(loc="best")
-plt.savefig(os.path.join(out_dir,"online-nb.pdf"))
+plt.axis([0,100,50,100])
+plt.savefig(os.path.join(out_dir,"online-nb.pdf"),bbox_inches="tight",pad_inches=0.05)
+
#online,SHT
-plt.cla()
+plt.figure()
for i in l:
x,y = np.loadtxt(i+"_sht_on.mat",unpack=True)
- plt.plot(100*x,100*y,label="$n_p=$ "+i,linewidth=0.8,markersize=4)
+ plt.plot(100*x,100*y,label="$n_p=$ "+i)
plt.xlabel("Recall [%]")
plt.ylabel("Precision [%]")
plt.legend(loc="best")
-plt.savefig(os.path.join(out_dir,"online-sht.pdf"))
-
+plt.axis([0,100,50,100])
+plt.savefig(os.path.join(out_dir,"online-sht.pdf"),bbox_inches="tight",pad_inches=0.05)
#face
-plt.cla()
+plt.figure()
x,y = np.loadtxt("all_nb_off.mat",unpack=True)
a,b = np.loadtxt("face.csv",delimiter=",", unpack=True)
-plt.plot(100*x,100*y,linewidth=0.8,label="Skeleton")
-plt.plot(100*a,100*b,linewidth=0.8,label="Face")
+plt.plot(100*x,100*y,label="Skeleton")
+plt.plot(100*a,100*b,label="Face")
plt.xlabel("Recall [%]")
plt.ylabel("Precision [%]")
plt.legend(loc="best")
-plt.savefig(os.path.join(out_dir,"face.pdf"))
+plt.axis([0,100,50,100])
+plt.savefig(os.path.join(out_dir,"face.pdf"),bbox_inches="tight",pad_inches=0.05)
#back
-plt.cla()
+plt.figure()
x,y = np.loadtxt("back_all_sht_on.mat",unpack=True)
a,b = np.loadtxt("all_sht_on.mat",unpack=True)
c,d = np.loadtxt("front_back_all_sht.mat",unpack=True)
-plt.plot(100*a,100*b,linewidth=0.8,label="Train/test toward")
-plt.plot(100*x,100*y,linewidth=0.8,label="Train/test away")
-plt.plot(100*c,100*d,linewidth=0.8,label="Train toward test away")
+plt.plot(100*a,100*b,label="Train/test toward")
+plt.plot(100*x,100*y,label="Train/test away")
+plt.plot(100*c,100*d,label="Train toward test away")
plt.xlabel("Recall [%]")
plt.ylabel("Precision [%]")
plt.legend(loc="best")
-plt.savefig(os.path.join(out_dir,"back.pdf"))
+plt.axis([0,100,50,100])
+plt.savefig(os.path.join(out_dir,"back.pdf"),bbox_inches="tight",pad_inches=0.05)
#variance-reduction
-plt.cla()
+plt.figure()
x,y = np.loadtxt("half-var-all_sht_on.mat",unpack=True)
a,b = np.loadtxt("all_sht_on.mat",unpack=True)
-plt.plot(100*x,100*y,linewidth=0.8,label="Reduced noise")
-plt.plot(100*a,100*b,linewidth=0.8,label="Original noise")
+plt.plot(100*x,100*y,label="Reduced noise")
+plt.plot(100*a,100*b,label="Original noise")
plt.xlabel("Recall [%]")
plt.ylabel("Precision [%]")
plt.legend(loc="best")
-plt.savefig(os.path.join(out_dir,"var.pdf"))
+plt.axis([0,100,50,100])
+plt.savefig(os.path.join(out_dir,"var.pdf"),bbox_inches="tight",pad_inches=0.05)