In [2]:
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd

In [3]:
%matplotlib inline
sns.set()

In [20]:
sns.set_context('paper')
sns.set_style('white')

In [21]:
filtering_data = pd.read_csv('gpsfilt.csv', header=None)

In [6]:
cp = sns.choose_colorbrewer_palette('qualitative')



In [22]:
plt.figure(figsize=(4,3),dpi=300)
labels = ['GPS Speed','Filtered Speed']

for i,c in enumerate(cp):
    plt.plot(filtering_data.T[i+1], color=c,lw=1,label=labels[i])

plt.legend(loc='upper left')
plt.xlim([0,423])
plt.ylim([0,50])
plt.xlabel('Position (m)')
plt.ylabel('Speed (km/hr)')
plt.title('GPS Filtering')
plt.tight_layout()
plt.savefig('../../papers/itsc2015/pics/gpsKalmanFiltering.pdf')
#sns.despine(left=True, bottom=True)



In [23]:
vel = pd.read_csv('vels.csv',header=None)
vel = vel.T
vel.head()


Out[23]:
0 1
0 7.4686 7.2891
1 12.1360 11.9120
2 13.7440 13.3610
3 14.2920 13.9990
4 15.1940 15.0080

In [24]:
plt.figure(figsize=(4,3),dpi=300)
labels = ['Raw Speed','Restricted Speed']

for i,c in enumerate(cp):
    plt.plot(vel[i], color=c,lw=1,label=labels[i])

plt.legend(loc='upper right')
plt.xlim([0,73])
plt.ylim([0,48])
plt.xlabel('Position (m)')
plt.ylabel('Speed (km/hr)')
plt.title('Speed Restriction')
plt.tight_layout()
plt.savefig('../../papers/itsc2015/pics/velocityRestriction.pdf')
#sns.despine(left=True, bottom=True)



In [25]:
x = np.array([0.25,2,3])
w = 0.8
fuel = [7983, 7421, 7289]
accoustic = [25119, 9043, 8032]

plt.figure(figsize=(4,2),dpi=300)

ax = plt.subplot(121)
ax.bar(x, fuel, width=w)
sns.despine()
ax.set_xlim([0,3.25+w])
ax.set_xticks(x+w/2)
ax.set_xticklabels( ('V1','V2','V3') )
ax.set_ylabel('Fuel Cost')
ax.set_yticks([])
#ax.set_yticks([0, 8000])
#ax.set_yticklabels(('0','8'))

lbls = ['','-7.0%','-8.7%']
for xp,yp,lbl in zip(x,fuel,lbls):
    ax.text(xp+.5*w, 1.02*yp, lbl,ha='center', va='bottom',fontsize=8)

ax = plt.subplot(122)
ax.bar(x, accoustic, width=w)
sns.despine()
ax.set_xlim([0,3.25+w])
ax.set_xticks(x+w/2)

ax.set_xticklabels( ('V1','V2','V3') )
ax.set_ylabel('Acoustic Cost')
ax.set_ylim([0,26000])
#ax.set_yticks([0, 5000, 10000, 15000, 20000,25000])
#ax.set_yticklabels(('0','5','10','15','20','25'))
ax.set_yticks([])
lbls = ['','-64%','-68%']
for xp,yp,lbl in zip(x,accoustic,lbls):
    ax.text(xp+.5*w, 1.02*yp, lbl,ha='center', va='bottom',fontsize=8)

plt.tight_layout()
plt.savefig('../../papers/itsc2015/pics/SimulationResults_newAxes.pdf')



In [26]:
x =  np.array([0.25, 2])
accoustic = [20078/0.26, 20078]
eff = [0.2480, 0.2780]

plt.figure(figsize=(4,2),dpi=300)

ax = plt.subplot(121)
ax.bar(x, eff, width=w)
sns.despine()
ax.set_xlim([0,2.25+w])
ax.set_xticks(x+w/2)
ax.set_xticklabels( ('V1','V2') )
ax.set_ylabel('REX Efficiency')
#ax.set_yticks([])
#ax.set_yticks([0, 8000])
#ax.set_yticklabels(('0','8'))

lbls = ['','+12%']
for xp,yp,lbl in zip(x,eff,lbls):
    ax.text(xp+.5*w, 1.02*yp, lbl,ha='center', va='bottom',fontsize=8)

ax = plt.subplot(122)
ax.bar(x, accoustic, width=w)
sns.despine()
ax.set_xlim([0,2.25+w])
ax.set_xticks(x+w/2)

ax.set_xticklabels( ('V1','V2') )
ax.set_ylabel('Acoustic Cost')
#ax.set_ylim([0,26000])
#ax.set_yticks([0, 5000, 10000, 15000, 20000,25000])
#ax.set_yticklabels(('0','5','10','15','20','25'))
ax.set_yticks([])
lbls = ['','-74%']
for xp,yp,lbl in zip(x,accoustic,lbls):
    ax.text(xp+.5*w, 1.02*yp, lbl,ha='center', va='bottom',fontsize=8)

plt.tight_layout()
plt.savefig('../../papers/itsc2015/pics/VehicleResults_newAxes.pdf')



In [27]:
x =  np.array([0,1,2,3])
data = [-50, -73, -93, -97]
w = 0.8

plt.figure(figsize=(4,2.5),dpi=300)

ax = plt.subplot(111)
ax.bar(x, data, width=w)

ax.set_xlim([-.25,3.25+w])
ax.set_xticks(x+w/2)
ax.set_xticklabels( ('0%','4%', '8%', '12%') )
ax.set_ylabel('Acoustic Cost Reduction')
ax.set_xlabel('Delta SOC')
ax.set_yticks([0, -25, -50, -75, -100])
#ax.set_yticks([0, 8000])
ax.set_yticklabels(('0','-25%','-50%','-75%','-100%'))
ax.xaxis.tick_top()
ax.xaxis.set_label_position('top')
#sns.despine(bottom=True, top=False)

plt.tight_layout()
plt.savefig('../../papers/itsc2015/pics/SOCdependency_newAxes.pdf')