看板 Python 關於我們 聯絡資訊
小弟寫了一個繪製國徽的程式如下, 執行以後總是不能把中間的圓填滿白色, 甚是苦惱, 請問各位大大, 有沒有辦法? ======================================================= 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
papple23g: cir2 增加參數 zorder=3 04/05 02:39
lycantrope: zorder:float是圖層順序,數字越大圖形會優先顯示 04/05 09:43
tang1019: 非常感謝兩位, 問題得以解決, 真開心! 04/06 22:23