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

看板Python作者 (燢)時間2年前 (2022/04/04 17:40), 編輯推噓2(201)
留言3則, 3人參與, 2年前最新討論串1/1
小弟寫了一個繪製國徽的程式如下, 執行以後總是不能把中間的圓填滿白色, 甚是苦惱, 請問各位大大, 有沒有辦法? ======================================================= 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://www.ptt.cc/bbs/Python/M.1649065227.A.A6F.html

04/05 02:39, 2年前 , 1F
cir2 增加參數 zorder=3
04/05 02:39, 1F

04/05 09:43, 2年前 , 2F
zorder:float是圖層順序,數字越大圖形會優先顯示
04/05 09:43, 2F

04/06 22:23, 2年前 , 3F
非常感謝兩位, 問題得以解決, 真開心!
04/06 22:23, 3F
文章代碼(AID): #1YIhqBfl (Python)