PlotCosts



In [2]:
# plots for abstracted penalty functions

import numpy as np

path_to_csv = "Costs50.csv"
data = np.genfromtxt(path_to_csv, dtype=float, delimiter=';')
#times = data[:,0].astype(int)
power50 = data[:,0]
costs50 = data[:,1]

In [6]:
import pylab
import numpy as np
from pylab import arange,pi,sin,cos,sqrt
fig_width_pt = 400  # Get this from LaTeX using \showthe\columnwidth
inches_per_pt = 1.0/72.27               # Convert pt to inch
golden_mean = (sqrt(5)-1.0)/2.0         # Aesthetic ratio
fig_width = fig_width_pt*inches_per_pt  # width in inches
fig_height = fig_width*golden_mean      # height in inches
fig_size =  [fig_width,fig_height]

#plt.setp(lines, color=isseorange, linewidth=2.0)
params = {'backend': 'ps',
          'axes.labelsize': 20,
          'text.fontsize': 18,
          'legend.fontsize': 14,
          'xtick.labelsize': 14,
          'ytick.labelsize': 14,
          'text.usetex': True,
          'figure.figsize': fig_size}
pylab.rcParams.update(params)
# Generate data
# Plot data
pylab.figure(1)
pylab.rcParams.update(params)
pylab.clf()
pylab.axes([0.125,0.2,0.95-0.125,0.95-0.2])

plt.plot(power50, costs50, color="green", label="50 sampling points")
pylab.xlabel('$\mathcal{P}$')
pylab.ylabel('$Costs$')
#pylab.legend()
legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
pylab.savefig('powerToCosts.pdf', bbox_inches='tight', pad_inches=0.1)



In [21]:
# simulate sampling at fewer points

power11 = power50[0::5]
costs11 = costs50[0::5]

power28 = power50[0::2] 
costs28 = costs50[0::2]

power8 = power50[0::7]
costs8 = costs50[0::7]

# Plot data
pylab.figure(1)
pylab.rcParams.update(params)
pylab.clf()
pylab.axes([0.125,0.2,0.95-0.125,0.95-0.2])

plt.plot(power50, costs50, color="green", label="50 sampling points")
plt.plot(power28, costs28, color="red", label="28 sampling points")
plt.plot(power11, costs11, color="blue", label="11 sampling points")
plt.plot(power8, costs8, color="magenta", label="8 sampling points")
pylab.xlabel('$\mathcal{P}$')
pylab.ylabel('$Costs$')


#pylab.legend()
legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
pylab.savefig('powerToCosts.pdf', bbox_inches='tight', pad_inches=0.1)



In [ ]: