PlotCosts



In [3]:
# plots for abstracted penalty functions

import numpy as np

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

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 [2]:
import pylab
import numpy as np
from pylab import arange,pi,sin,cos,sqrt
fig_width_pt = 500  # 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}
rcParams['figure.figsize'] = 5, 10
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(power, costs, color="green", label="5 sampling points")
plt.plot(power50, costs50, color="red", 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 [4]: