title: Linear trendline appearing non-linear
body: <p>I'm working on creating a linear trendline from data that contains dates and another measure (volume). The goal is to create a linear trendline that shows how volume trends over time. </p>
  
  <p>The data looks as follows:</p>
  
  <pre><code>          date  typeID  lowPrice  highPrice  avgPrice  volume  orders  \
  0   2003-11-30    22.0   9000.00    9000.00   9000.00     5.0     1.0   
  1   2003-12-31    22.0   9000.00    9000.00   9000.00     2.0     1.0   
  2   2004-01-31    22.0  15750.00   15750.00  15750.00     9.5     1.0   
  3   2004-02-29    22.0   7000.00    7000.00   7000.00    11.0     1.0   
  4   2004-03-31    22.0   7000.00    7000.00   7000.00     8.0     1.0   
  6   2004-05-31    22.0  15000.00   15000.00  15000.00    16.0     1.0   
  10  2004-09-30    22.0   6500.00    6500.00   6500.00    27.0     1.0
  </code></pre>
  
  <p>The issue is that for some months (the interval in which the dates are stored) there is no volume data available as can be seen above, thus the following is the approach I currently take at creating a trendline from the available dates. </p>
  
  <pre><code>x = df2["date"]
  
  df2["inc_dates"] = np.arange(len(x))
  
  y = df2["ln_vold"]
  
  plt.subplot(15, 4, count)
  plt.plot_date(x, y, xdate = True)
  
  model = smf.ols('ln_vold ~ inc_dates', missing = "drop", data = df2).fit()
  intercept, coef = model.params
  
  l = [intercept]
  
  for i in range(len(x) -1):
      l.append(intercept + coef*i)
  
  plt.plot_date(x, l, "r--", xdate = True)
  </code></pre>
  
  <p>However the output for this currently shows: <a href="https://i.stack.imgur.com/7Lqvm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7Lqvm.png" alt="Plot"></a></p>
  
  <p>Which clearly isn't the right trendline (seen by the beginning being non-linear).</p>
  
  <p>Now I don't see how this could go wrong, as all I do in the for-loop is add constant values to an increasing integer. All I'd like to see is a linear trendline going straight from the intercept to the end. </p>