import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Arc

# Set parameters for blue quarter-circle
blue_radius = 1
theta_start = 90
theta_end = 225
theta = np.linspace(theta_start, theta_end, 300)
theta_rad = np.deg2rad(theta)
x = blue_radius * np.cos(theta_rad)
y = blue_radius * np.sin(theta_rad)
end_point_x = x[-1]
end_point_y = y[-1]

# Set parameters for red semi-circle
red_diameter = blue_radius / 6
red_radius = red_diameter / 2
red_center_x = end_point_x
red_center_y = end_point_y - red_radius
red_rotation = 45  # New parameter: rotation angle in degrees

# Create the plot
fig, ax = plt.subplots(figsize=(8, 8))

# Plot the blue quarter-circle
ax.plot(x, y, color='blue', linewidth=2, label='Blue Quarter-Circle')

# Plot the rotated red semi-circle
red_arc = Arc((red_center_x, red_center_y), red_diameter, red_diameter,
              angle=red_rotation, theta1=270, theta2=90, edgecolor='red', linewidth=2, label='Rotated Red Semi-Circle')
ax.add_patch(red_arc)

# Set equal aspect ratio and remove axes
ax.set_aspect('equal', adjustable='box')
ax.axis('off')

# Add legend
ax.legend()

# Display the plot
plt.show()