diff options
Diffstat (limited to 'data/combined/graphs')
| -rwxr-xr-x | data/combined/graphs/plots.py | 64 |
1 files changed, 39 insertions, 25 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) |
