作者tang1019 (燢)
看板Python
标题[问题] 国徽中间的圆为何无法填满白色
时间Mon Apr 4 17:40:13 2022
小弟写了一个绘制国徽的程式如下, 执行以後总是不能把中间的圆填满白色,
甚是苦恼, 请问各位大大, 有没有办法?
=======================================================
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()
--
<)".."(>
( (..) )
im a pig
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 1.200.38.86 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1649065227.A.A6F.html
1F:推 papple23g: cir2 增加参数 zorder=3 04/05 02:39
2F:推 lycantrope: zorder:float是图层顺序,数字越大图形会优先显示 04/05 09:43
3F:→ tang1019: 非常感谢两位, 问题得以解决, 真开心! 04/06 22:23