Plot Sine Curve

#!/usr/bin/python3 # ========================================================== # plot sine curve # ========================================================== import math import matplotlib.pyplot as plt # ---------------------------------------------------------- # ---- sine curve x,y coordinates (x = 0 to 720 degrees) # ---------------------------------------------------------- def sine_curve_xy(): x_coords = [] y_coords = [] for deg in range(0,720,10): x_coords.append(deg) y_coords.append(math.sin(math.radians(deg))) return (x_coords,y_coords) # ---------------------------------------------------------- # ---- sine curve plot # ---------------------------------------------------------- def sine_curve_plot(): # ---- define plot plt.figure(figsize=(8.0,4.0),layout='tight') plt.title('Sine Curve', fontsize=18) plt.xlabel('X', fontsize=14) plt.ylabel('Y', fontsize=14) plt.grid(True) # ---- sine plot coordinates x_coords,y_coords = sine_curve_xy() # ---- plot sine curve plt.plot(x_coords,y_coords,color='red',linewidth=1.0) plt.show() # ---------------------------------------------------------- # ---- main # ---------------------------------------------------------- if __name__ == '__main__': sine_curve_plot()