title: Python Matplotlib - Smooth plot line for x-axis with date values
body: <p>Im trying to smooth a graph line out but since the x-axis values are dates im having great trouble doing this. Say we have a dataframe as follows    </p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  import pandas as pd
  %matplotlib inline
  
  startDate = '2015-05-15'
  endDate = '2015-12-5'
  index = pd.date_range(startDate, endDate)
  data = np.random.normal(0, 1, size=len(index))
  cols = ['value']
  
  df = pd.DataFrame(data, index=index, columns=cols)
  </code></pre>
  
  <p>Then we plot the data</p>
  
  <pre><code>fig, axs = plt.subplots(1,1, figsize=(18,5))
  x = df.index
  y = df.value
  axs.plot(x, y)
  fig.show()
  </code></pre>
  
  <p>we get</p>
  
  <p><a href="https://i.stack.imgur.com/zJha8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zJha8.jpg" alt="enter image description here"></a></p>
  
  <p>Now to smooth this line there are some usefull staekoverflow questions allready like: </p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/25825946/generating-smooth-line-graph-using-matplotlib">Generating smooth line graph using matplotlib</a>, </li>
  <li><a href="https://stackoverflow.com/questions/5283649/plot-smooth-line-with-pyplot">Plot smooth line with PyPlot</a></li>
  <li><a href="https://stackoverflow.com/questions/37964100/creating-numpy-linspace-out-of-datetime">Creating numpy linspace out of datetime</a></li>
  </ul>
  
  <p>But I just cant seem to get some code working to do this for my example, any suggestions?</p>