[问题] 国徽中间的圆为何无法填满白色

楼主: 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