[問題] 國徽中間的圓為何無法填滿白色

作者: tang1019 (燢)   2022-04-04 17:40:13
小弟寫了一個繪製國徽的程式如下, 執行以後總是不能把中間的圓填滿白色,
甚是苦惱, 請問各位大大, 有沒有辦法?
=======================================================
import math
import matplotlib.pyplot as plt
fig , ax = plt.subplots()
n = 12
hop = 5
theta = 6.2832 / n
for x in range(n):
y = (x+hop) % n
cx = math.cos(x * theta) * 240 + 360
cy = math.cos(y * theta) * 240 + 360
sx = math.sin(x * theta) * 240 + 270
sy = math.sin(y * theta) * 240 + 270
plt.plot([cx, cy], [sx, sy], color="b")
cir1 = plt.Circle(xy = (360, 270), radius=120, color='b', linewidth=10,
fill=True)
cir2 = plt.Circle(xy = (360, 270), radius=100, color='w', linewidth=10,
fill=True)
ax.add_patch(cir1)
ax.add_patch(cir2)
plt.axis('scaled')
plt.axis('equal')
plt.show()
作者: papple23g (逆道者)   2022-04-05 02:39:00
cir2 增加參數 zorder=3
作者: lycantrope (阿寬)   2022-04-05 09:43:00
zorder:float是圖層順序,數字越大圖形會優先顯示
作者: tang1019 (燢)   2022-04-06 22:23:00
非常感謝兩位, 問題得以解決, 真開心!

Links booklink

Contact Us: admin [ a t ] ucptt.com