title: I am getting two plots for one data set in python
body: <p>I am working through example 8.1 titled <em>Euler's Method</em> from Mark Newman's book Computational Physics. I rewrote the example as a method with Numpy arrays but when I plot it I get two plots on the same figure not sure how to correct it. Also is there better way to convert my 2 1D arrays into 1 2D array to use for plotting in Matplotlib, thanks.</p>
  
  <p>Newman's example :</p>
  
  <pre><code>from math import sin
  from numpy import arange
  from pylab import plot,xlabel,ylabel,show
  
  def f(x,t):
      return -x**3 + sin(t)
  
  a = 0.0           # Start of the interval
  b = 10.0          # End of the interval
  N = 1000          # Number of steps
  h = (b-a)/N       # Size of a single step
  x = 0.0           # Initial condition
  
  tpoints = arange(a,b,h)
  xpoints = []
  for t in tpoints:
      xpoints.append(x)
      x += h*f(x,t)
  
  plot(tpoints,xpoints)
  xlabel("t")
  ylabel("x(t)")
  show()
  </code></pre>
  
  <p>My modifications:</p>
  
  <pre><code>from pylab import plot,show,xlabel,ylabel
  from numpy import linspace,exp,sin,zeros,vstack,column_stack
  
  
  def f(x,t):
      return (-x**(3) + sin(t))
  
  def Euler(f,x0,a,b):
      N=1000    
      h = (b-a)/N
      t = linspace(a,b,N)
      x = zeros(N,float)
      y = x0
      for i in range(N):
          x[i] = y
          y += h*f(x[i],t[i])
  
      return column_stack((t,x)) #vstack((t,x)).T
  
  
  plot(Euler(f,0.0,0.0,10.0))
  xlabel("t")
  ylabel("x(t)")
  show()
  </code></pre>