import numpy as np import matplotlib.pyplot as plot # Get x values of the sine wave time = np.arange(0, 10, 0.1); # Amplitude of the sine wave is sine of a variable like time amplitude = np.sin(time) # Plot a sine wave using time and amplitude obtained for the sine wave plot.plot(time, amplitude) # Give a title for the sine wave plot plot.title('Sine wave') # Give x axis label for the sine wave plot plot.xlabel('Time') # Give y axis label for the sine wave plot plot.ylabel('Amplitude = sin(time)') plot.grid(True, which='both') plot.axhline(y=0, color='k') plot.show() # Display the sine wave
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question