summaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2012-03-04 16:36:06 -0800
committerThibaut Horel <thibaut.horel@gmail.com>2012-03-04 16:36:06 -0800
commit3dc183008e040aef7c64a4a5ede9557856326e31 (patch)
tree2b61e8f8769821180cc9ecc62f024a25a1d10765 /data
parentb14f133b7b8cb5d732ab7a97e6f50cf20dedce9a (diff)
downloadkinect-3dc183008e040aef7c64a4a5ede9557856326e31.tar.gz
Generate plots at the right size. The size shouldn't be set in the latex code
Diffstat (limited to 'data')
-rwxr-xr-xdata/combined/graphs/plots.py64
-rwxr-xr-xdata/pair-matching/roc.py16
2 files changed, 49 insertions, 31 deletions
diff --git a/data/combined/graphs/plots.py b/data/combined/graphs/plots.py
index 6f37b27..a4b01f3 100755
--- a/data/combined/graphs/plots.py
+++ b/data/combined/graphs/plots.py
@@ -8,15 +8,19 @@ import os
import scipy
import matplotlib as mpl
-mpl.rcParams['font.size'] = 8
+mpl.rcParams['font.size'] = 5
mpl.rcParams['lines.linewidth'] = 0.5
-mpl.rcParams['figure.figsize'] = 6,5
-mpl.rcParams['legend.fontsize'] = 8
-mpl.rcParams['axes.linewidth'] = 0.8
+mpl.rcParams['figure.figsize'] = 2.2,2.2
+mpl.rcParams['legend.fontsize'] = 5
+mpl.rcParams['axes.linewidth'] = 0.5
+mpl.rcParams['figure.subplot.hspace'] = 0.4
+mpl.rcParams['figure.subplot.wspace'] = 0.4
+legend_width = 0.2
+#mpl.rcParams.update(params)
out_dir = sys.argv[1]
#limbs distribution
-plt.figure()
+plt.figure(figsize=(5.6,1.7))
data = np.loadtxt("../limbs-avg-zdiff/data.csv",delimiter=",")
data = data[#(data[:,1] == 25)
((data != -1).all(1))
@@ -27,22 +31,25 @@ mean = data.mean(0)
var = data.std(0)
for i in range(len(mean)):
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]))
+ n,b,p = plt.hist((data[:,i]-mean[i]),bins=100,normed=1,linewidth=0,color="lightgreen")
+ plt.plot(b,mlab.normpdf(b,0,var[i]),"red")
+ plt.xticks([])
+ plt.yticks([])
+ plt.xlabel("$x_"+str(i+1)+"-E[x_"+str(i+1)+"|y]$")
+ plt.ylabel("$P(x_"+str(i+1)+"-E[x_"+str(i+1)+"|y])$")
plt.savefig(os.path.join(out_dir,"limbs.pdf"),bbox_inches="tight",pad_inches=0.05)
#frames distribution
-fig = plt.figure(figsize=(6,4))
+plt.figure(figsize=(4.5,2))
x = np.loadtxt("frames.txt",usecols=(0,))
y = range(1,len(x)+1)
width=0.8
-plt.bar(y,x/x.sum()*100,width=width)
+plt.bar(y,x/x.sum()*100,width=width,linewidth=0,color="lightgreen")
plt.xlim(0.8,26)
plt.xticks([i+width/2. for i in range(1,len(x),5)], range(1,len(x),5))
plt.xlabel("Individual")
plt.ylabel("Frame ratio [%]")
plt.ylim(0,17)
-ax = plt.gca()
plt.savefig(os.path.join(out_dir,"frames.pdf"),bbox_inches="tight",pad_inches=0.05)
l = ["3","5","10","all"]
@@ -52,9 +59,10 @@ 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)
- plt.xlabel("Recall [%]")
- plt.ylabel("Precision [%]")
- plt.legend(loc="best")
+plt.xlabel("Recall [%]")
+plt.ylabel("Precision [%]")
+leg =plt.legend(loc="best")
+leg.get_frame().set_linewidth(legend_width)
plt.axis([0,100,50,100])
plt.savefig(os.path.join(out_dir,"offline-nb.pdf"),bbox_inches="tight",pad_inches=0.05)
@@ -63,9 +71,10 @@ 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)
- plt.xlabel("Recall [%]")
- plt.ylabel("Precision [%]")
- plt.legend(loc="lower left")
+plt.xlabel("Recall [%]")
+plt.ylabel("Precision [%]")
+leg = plt.legend(loc="lower left")
+leg.get_frame().set_linewidth(legend_width)
plt.axis([0,100,50,100])
plt.savefig(os.path.join(out_dir,"offline-sht.pdf"),bbox_inches="tight",pad_inches=0.05)
@@ -74,9 +83,10 @@ 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)
- plt.xlabel("Recall [%]")
- plt.ylabel("Precision [%]")
- plt.legend(loc="best")
+plt.xlabel("Recall [%]")
+plt.ylabel("Precision [%]")
+leg = plt.legend(loc="best")
+leg.get_frame().set_linewidth(legend_width)
plt.axis([0,100,50,100])
plt.savefig(os.path.join(out_dir,"online-nb.pdf"),bbox_inches="tight",pad_inches=0.05)
@@ -85,9 +95,10 @@ 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)
- plt.xlabel("Recall [%]")
- plt.ylabel("Precision [%]")
- plt.legend(loc="best")
+plt.xlabel("Recall [%]")
+plt.ylabel("Precision [%]")
+leg = plt.legend(loc="best")
+leg.get_frame().set_linewidth(legend_width)
plt.axis([0,100,50,100])
plt.savefig(os.path.join(out_dir,"online-sht.pdf"),bbox_inches="tight",pad_inches=0.05)
@@ -99,7 +110,8 @@ 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")
+leg = plt.legend(loc="best")
+leg.get_frame().set_linewidth(legend_width)
plt.axis([0,100,50,100])
plt.savefig(os.path.join(out_dir,"face.pdf"),bbox_inches="tight",pad_inches=0.05)
@@ -113,7 +125,8 @@ 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")
+leg = plt.legend(loc="best")
+leg.get_frame().set_linewidth(legend_width)
plt.axis([0,100,50,100])
plt.savefig(os.path.join(out_dir,"back.pdf"),bbox_inches="tight",pad_inches=0.05)
@@ -125,6 +138,7 @@ 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")
+leg = plt.legend(loc="best")
+leg.get_frame().set_linewidth(legend_width)
plt.axis([0,100,50,100])
plt.savefig(os.path.join(out_dir,"var.pdf"),bbox_inches="tight",pad_inches=0.05)
diff --git a/data/pair-matching/roc.py b/data/pair-matching/roc.py
index 19a1acf..7396ab4 100755
--- a/data/pair-matching/roc.py
+++ b/data/pair-matching/roc.py
@@ -6,11 +6,14 @@ import matplotlib as mpl
import math
from sets import ImmutableSet
-mpl.rcParams['font.size'] = 8
+mpl.rcParams['font.size'] = 5
mpl.rcParams['lines.linewidth'] = 0.5
-mpl.rcParams['figure.figsize'] = 6,5
-mpl.rcParams['legend.fontsize'] = 8
-mpl.rcParams['axes.linewidth'] = 0.8
+mpl.rcParams['figure.figsize'] = 2.2,2.2
+mpl.rcParams['legend.fontsize'] = 5
+mpl.rcParams['axes.linewidth'] = 0.5
+mpl.rcParams['figure.subplot.hspace'] = 0.4
+mpl.rcParams['figure.subplot.wspace'] = 0.4
+legend_width = 0.2
def distance(a,b):
return math.sqrt(np.square(a-b).sum())
@@ -43,6 +46,7 @@ def gen_pairs(var,sk_data):
return result
if __name__ == "__main__":
+ plt.figure(figsize=(3,2.2))
ap = np.loadtxt("associatepredict.txt",delimiter=",")
indices = [i for i in range(ap.shape[0]) if ap[i,1]<0.1]
ap_false = ap[:,1][indices]
@@ -74,9 +78,9 @@ if __name__ == "__main__":
true_pos = np.array(true_pos)
true_pos = true_pos[indices]
plt.plot(false_pos,true_pos,label="$\sigma$ = "+str(s))
- plt.legend(loc="lower right")
+ leg = plt.legend(loc="lower right")
+ leg.get_frame().set_linewidth(legend_width)
plt.savefig("roc.pdf",bbox_inches="tight",pad_inches=0.05)
- plt.show()