title: Graphing Polynomial Fit for Solar Data
body: <p>I have spent approximately 2.5 hours sitting here trying to get a very simple thing to work but I've got to that point where I can't see it with fresh eyes. So despite it being straightforward I could really do with some help as I'm getting frustrated.</p>
  
  <p>The problem is to plot a polynomial in python, simple right?
  So I've obtained a polynomial fit from excel which actually looks very much like a gaussian, but that's not important. However, my plotting code seems unable to handle it. Despite code in my project operating in exactly the same manner without issue.</p>
  
  <p>Ignore the random import as it was just a copy and paste jobby from my main document.</p>
  
  <p>It should look like the photo I have attached. But currently it's blowing up in my face. It's likely a really simple issue but I've stared at it for far too long and so am blind to it.</p>
  
  <p>Many thanks to those that take the time to help me out. I really apprecciate it!
  <a href="https://i.stack.imgur.com/5zTTV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5zTTV.jpg" alt="the resulting plot"></a></p>
  
  <pre><code>import numpy as np 
  import random 
  import matplotlib.pyplot as pyplot
  
  timebase = 1440
  t0 = 0
  ts = np.arange(t0, timebase, 1) # Create range between 0 and Max with 1 min spacing 
  
  def solar():
      values = np.array( range(timebase), dtype = float) # Irradiance ie// Power / m^2
      # Solar Irradiance Parameters:
  
      for t in range(timebase):
          if 0 &lt;= t &lt; 210:
              values[t] = 0.00
          if 210 &lt;= t &lt; 1290:
              values[t] = ( (-2.00E-16)*(t**6) ) + ( (9.00E-13)*(t**5) ) - ( (1.00E-9)*(t**4) ) + ( (1.00E-6)*(t**3) ) - ( (0.0004)*(t**2) ) + ( (0.0795)*(t) ) - 5.4647
          if t &gt;= 1290:
              values[t] = 0.00
  
       # Irradiance Efficiency Parameters
      return values
  
  Test_sol =  solar()
  
  pyplot.plot(ts, Test_sol, color = 'b', linewidth = 0.5)
  pyplot.ylabel("Solar Power, kW") 
  pyplot.xlabel("Time (Minutes)") 
  pyplot.legend()
  pyplot.ylim(0,)
  pyplot.show()
  </code></pre>