File size: 1,664 Bytes
0e3c3b0 |
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 34 35 36 37 38 39 40 41 42 43 44 45 |
import matplotlib.pyplot as plt
import matplotlib.patches as patches
# Calculate the quotients
quotient = (65000000 / 44414)/1#00
ht_quotient = (65000000 / 9249)/1#00
# Sizes for the circles
grey_circle_size = 20000
pink_circle_size = grey_circle_size/quotient
# Plot the circles side by side
fig, ax = plt.subplots(figsize=(20, 20))
# Plot grey circle on the left with a black outline
grey_radius = grey_circle_size**0.5 / 500
grey_circle = plt.Circle((0.3, 0.5), radius=grey_radius, color="grey", ec="black", lw=2, alpha=0.3)
ax.add_patch(grey_circle)
# Calculate the red/blue circle size based on ht_quotient
red_blue_circle_radius = (grey_circle_size / ht_quotient)**0.5 / 500
# Position the red/blue circle on the right edge of the grey circle
red_blue_circle_center_x = 0.25 + grey_radius - red_blue_circle_radius
# Add the half red, half blue circle by overlaying two half-circle patches
red_half_circle = patches.Wedge((red_blue_circle_center_x, 0.5), red_blue_circle_radius, 90, 270, color="#de8a8a", ec="black", lw=1)
blue_half_circle = patches.Wedge((red_blue_circle_center_x, 0.5), red_blue_circle_radius, 270, 90, color="#6ea4da", ec="black", lw=1)
# Add the half-circle patches to the plot
ax.add_patch(red_half_circle)
ax.add_patch(blue_half_circle)
# Plot pink circle on the right with a black outline
pink_circle = plt.Circle((0.6, 0.5), radius=pink_circle_size**0.5 / 500, color="mediumpurple", ec="black", lw=2, alpha=0.7)
ax.add_patch(pink_circle)
# Set aspect ratio and limits
ax.set_aspect('equal')
ax.set_xlim(0, 1)
ax.set_ylim(0, 1)
ax.axis('off') # Turn off axes
plt.tight_layout()
plt.savefig('circles.png', dpi=300)
plt.show() |