-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathPolar_Plot_of_Trigonometric_Ratios.py
More file actions
33 lines (26 loc) · 1.08 KB
/
Polar_Plot_of_Trigonometric_Ratios.py
File metadata and controls
33 lines (26 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Import required libraries
import numpy as np
import matplotlib.pyplot as plt
# Create an array of angles from 0 to 360 degrees
angles_degrees = np.arange(0, 360, 1)
angles_radians = np.radians(angles_degrees)
# Calculate trigonometric ratios
sine_values = np.sin(angles_radians)
cosine_values = np.cos(angles_radians)
tangent_values = np.tan(angles_radians)
# Create a polar plot
plt.figure(figsize=(8, 8))
ax = plt.subplot(111, polar=True)
# Plot trigonometric ratios
ax.plot(angles_radians, sine_values, label='Sine', color='blue')
ax.plot(angles_radians, cosine_values, label='Cosine', color='red')
ax.plot(angles_radians, tangent_values, label='Tangent', color='green')
# Set labels and title
ax.set_xticks(np.radians([0, 45, 90, 135, 180, 225, 270, 315])) # Set radial ticks at specified angles
ax.set_xticklabels(['0°', '45°', '90°', '135°', '180°', '225°', '270°', '315°']) # Label the radial ticks
ax.set_rlabel_position(90) # Move radial labels away from the plot
ax.set_title('Polar Plot of Trigonometric Ratios')
# Add a legend
ax.legend()
# Show the polar plot
plt.show()