Untitled
import matplotlib.pyplot as plt import numpy as np # Define the radius radius = 5 # Define the center of the circle center = (0, 0) # Create the theta values theta = np.linspace(0, 2 * np.pi, 100) # Parametric equations for the circle x = center[0] + radius * np.cos(theta) y = center[1] + radius * np.sin(theta) # Plot the circle plt.figure(figsize=(6,6)) plt.plot(x, y, label='Circle') plt.plot(center[0], center[1], 'ro') # Center of the circle plt.plot(3, 4, 'bo') # Point (3, 4) on the circle # Plot the axes plt.axhline(0, color='black',linewidth=0.5) plt.axvline(0, color='black',linewidth=0.5) # Set the aspect ratio to be equal plt.gca().set_aspect('equal', adjustable='box') # Labeling the plot plt.title('Circle with center at the origin and radius 5') plt.xlabel('x') plt.ylabel('y') plt.grid(True) plt.legend() # Show the plot plt.show()
Leave a Comment