Untitled

 avatar
unknown
plain_text
a year ago
1.2 kB
4
Indexable
import matplotlib.pyplot as plt
import numpy as np

# Create the figure and axis
fig, ax = plt.subplots()

# Draw the eye
eye_circle = plt.Circle((0.5, 0.5), 0.4, edgecolor='black', facecolor='none')
ax.add_patch(eye_circle)

# Draw the retina
retina_line = plt.Line2D([0.9, 0.9], [0.3, 0.7], color="red", linewidth=2)
ax.add_line(retina_line)

# Draw the focal point (behind the retina)
focal_point = plt.Line2D([1.1, 1.1], [0.4, 0.6], color="blue", linewidth=2)
ax.add_line(focal_point)

# Draw light rays converging behind the retina
rays_x = np.linspace(0.9, 1.1, 10)
rays_y = np.linspace(0.4, 0.5, 10)
ax.plot(rays_x, rays_y, 'blue')

rays_y2 = np.linspace(0.6, 0.5, 10)
ax.plot(rays_x, rays_y2, 'blue')

# Annotate the diagram
ax.text(0.5, 0.5, "Eye", horizontalalignment='center', verticalalignment='center')
ax.text(0.9, 0.2, "Retina", horizontalalignment='center', verticalalignment='center', color="red")
ax.text(1.1, 0.3, "Focal Point", horizontalalignment='center', verticalalignment='center', color="blue")

# Set the limits and aspect ratio
ax.set_xlim(0, 1.5)
ax.set_ylim(0, 1)
ax.set_aspect('equal')

# Remove axis
ax.axis('off')

# Display the diagram
plt.show()
Editor is loading...
Leave a Comment