title: Python piecewise function interpolation
body: <p>i am trying to construct a function which gives me interpolated values of a piecewise linear function. I tried linear spline interpolation (which should be able to do exactly this?)- but without any luck. The problem is most visible on a log scale plot. Below there is the code of a small example i prepared:</p>
  
  <pre><code>%matplotlib inline
  import matplotlib.pyplot as plt
  import pandas as pd
  import numpy as np
  import os
  from scipy import interpolate
  
  #Original Data
  pwl_data = np.array([[0,1e3, 1e5, 1e8], [-90,-90, -90, -130]])
  
  #spine interpolation
  pwl_spline = interpolate.splrep(pwl_data[0], pwl_data[1])
  
  spline_x = np.linspace (0,1e8, 10000)
  
  legend = []
  
  plt.plot(pwl_data[0],pwl_data[1])
  plt.plot(spline_x,interpolate.splev(spline_x,pwl_spline ),'*')
  legend.append("Data")
  legend.append("Interpolated Data")
  
  plt.xscale('log')
  plt.legend(legend) 
  plt.grid(True)
  plt.grid(b=True, which='minor', linestyle='--')
  plt.show()
  </code></pre>
  
  <p>What am I doing wrong?</p>