From 7573989c8843c5fc2f7d74a67d8c5da10a9ccfc4 Mon Sep 17 00:00:00 2001 From: Muskansingh33 <149399411+Muskansingh33@users.noreply.github.com> Date: Mon, 30 Oct 2023 23:07:59 +0530 Subject: [PATCH] Create graph --- graph | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 graph diff --git a/graph b/graph new file mode 100644 index 0000000..0e07ea3 --- /dev/null +++ b/graph @@ -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()