Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions graph
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import numpy as np

import matplotlib.pyplot as plot



# Get x values of the cosine wave

time = np.arange(0, 20, 0.2);



# Amplitude of the cosine wave is cosine of a variable like time

amplitude = np.cos(time)



# Plot a cosine wave using time and amplitude obtained for the cosine wave

plot.plot(time, amplitude)



# Give a title for the cosine wave plot

plot.title('Cosine wave')



# Give x axis label for the cosine wave plot

plot.xlabel('Time')



# Give y axis label for the cosine wave plot

plot.ylabel('Amplitude = cosine(time)')



# Draw the grid for the graph

plot.grid(True, which='both')



plot.axhline(y=0, color='b')



# Display the cosine wave plot

plot.show()