title: How to plot a continuous sine wave in Python?
body: <p>I am trying to simulate the display of a sine wave one would generate from an oscilloscope using Python. As I am trying to merely simulate it (and not pull the data from the oscilloscope), I was wondering how I would show a continuous sine wave. I have the sample rate of the device (200MHz - 1GS/s), the frequency of my wave (1MHz), and the amplitude (1V). The data would be viewed in microseconds. I have read through various answers here on StackOverflow and have had problems with the plot having irregular waves or something of the sort. Is there a way to have this data shown like below? <a href="https://i.stack.imgur.com/sPVC9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sPVC9.png" alt="Oscilloscope data output I wish to simulate, for 1MHz freq, 100MS/s sample rate, amplitude of 1V."></a></p>
  
  <p>A secondary problem is the ability to plot this wave continuously. For example, when using Matplotlib, if I zoom out it doesn't show the wave continuing past my interval. Is there a way to have the wave continually represented? I don't want to be tied down to Matplotlib, so I am looking for other solutions that continually creating (appending?) data in both directions. If this is not possible, is it possible to establish some sort of number of wavelengths in each direction?</p>
  
  <p>Thank you so much!</p>
  
  <pre><code>import numpy as np
  from scipy import signal
  import matplotlib.pyplot as plt
  
  Fs = 20E3
  f = 1E6
  sample = Fs/f
  print(sample)
  x = np.arange(sample)
  
  y = 100*np.sin(2 * np.pi * f * x / Fs)
  
  plt.plot(x, y)
  plt.show()
  </code></pre>