Untitled

mail@pastecode.io avatar
unknown
plain_text
12 days ago
1.4 kB
2
Indexable
Never
import numpy as np
import matplotlib.pyplot as plt


fig, ax = plt.subplots()
ax.set_xlim(-1.5,5)
ax.set_ylim(-1.5, 1.5)
fig.patch.set_facecolor("skyblue")
ax.set_facecolor("skyblue")
ax.set_aspect("equal")

# Draw Circles for the Charkha
circle = plt.Circle((0,0),1,color="#663d14", fill = False, linewidth = 7)
ax.add_artist(circle)
small_circle = plt.Circle((3.85, -0.95), 0.15, color = "#1b0000", fill = True, linewidth = 2)
ax.add_artist(small_circle)



# Lets Draw the Spokes within the Charkha
num_spokes = 24
angles = np.linspace(0, 2 * np.pi, num_spokes, endpoint = False) # divide circle into angles
for angle in angles:
    ax.plot([0, np.cos(angle)],[0, np.sin(angle)], color = "black") # Draw each spokes


# Lets draw the frame and the thread

ax.plot([0,4],[-1,-1], color="black", linewidth = 1) # bottom tangent (thread)
ax.plot([0.3,4],[1,-1], color="black", linewidth = 1) # diagonal tangent (thread)
ax.plot([0,0],[0,-6], color="black", linewidth = 8) #Verticle line from the centre
ax.plot([0,4],[0,-1], color="black", linewidth = 8) # Diagonal Line from the centre to the tangent
ax.plot([0, 4],[-1.5,-1.5], color="black", linewidth = 20) # Horizontal line along the x axis
ax.plot([3.85,3.85],[-1,-1.5], color="black", linewidth = 6) # verticle line from the tangent intersection




plt.show() # display plot


# Thankyou
Leave a Comment