{"id":1186334,"date":"2025-01-15T19:51:21","date_gmt":"2025-01-15T11:51:21","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1186334.html"},"modified":"2025-01-15T19:51:24","modified_gmt":"2025-01-15T11:51:24","slug":"python%e5%a6%82%e4%bd%95%e5%a1%ab%e5%85%85%e9%a2%9c%e8%89%b2%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1186334.html","title":{"rendered":"python\u5982\u4f55\u586b\u5145\u989c\u8272\u4ee3\u7801"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25135150\/682e3e7e-428e-4bbb-a24c-f928de1e970f.webp\" alt=\"python\u5982\u4f55\u586b\u5145\u989c\u8272\u4ee3\u7801\" \/><\/p>\n<p><p> <strong>\u8981\u5728Python\u4e2d\u586b\u5145\u989c\u8272\u4ee3\u7801\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u79cd\u65b9\u6cd5\u548c\u5e93\uff0c\u4f8b\u5982matplotlib\u3001PIL\u3001OpenCV\u7b49\u3002<\/strong> \u9996\u5148\uff0c\u6211\u4eec\u6765\u770b\u4e00\u4e2a\u5e38\u89c1\u7684\u586b\u5145\u989c\u8272\u7684\u5e93\u2014\u2014matplotlib\u3002<strong>\u5728matplotlib\u4e2d\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e\u56fe\u5f62\u5bf9\u8c61\u7684\u5c5e\u6027\u6765\u586b\u5145\u989c\u8272<\/strong>\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<code>fill_between<\/code>\u51fd\u6570\u53ef\u4ee5\u586b\u5145\u4e24\u4e2a\u66f2\u7ebf\u4e4b\u95f4\u7684\u533a\u57df\uff0c\u4f7f\u7528<code>bar<\/code>\u51fd\u6570\u53ef\u4ee5\u586b\u5145\u6761\u5f62\u56fe\u7684\u989c\u8272\u7b49\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\uff0c\u8be6\u7ec6\u63cf\u8ff0\u4e86\u5982\u4f55\u4f7f\u7528matplotlib\u586b\u5145\u989c\u8272\uff1a<\/p>\n<\/p>\n<p><p>\u5728matplotlib\u4e2d\u586b\u5145\u989c\u8272\u7684\u4e00\u4e2a\u5e38\u89c1\u65b9\u6cd5\u662f\u4f7f\u7528<code>fill_between<\/code>\u51fd\u6570\u3002\u8fd9\u4e2a\u51fd\u6570\u53ef\u4ee5\u7528\u6765\u586b\u5145\u4e24\u4e2a\u66f2\u7ebf\u4e4b\u95f4\u7684\u533a\u57df\uff0c\u6216\u8005\u586b\u5145\u67d0\u4e2a\u66f2\u7ebf\u5230x\u8f74\u4e4b\u95f4\u7684\u533a\u57df\u3002\u6211\u4eec\u6765\u770b\u4e00\u4e2a\u5177\u4f53\u7684\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<p>import numpy as np<\/p>\n<h2><strong>\u751f\u6210\u6570\u636e<\/strong><\/h2>\n<p>x = np.linspace(0, 2 * np.pi, 100)<\/p>\n<p>y1 = np.sin(x)<\/p>\n<p>y2 = np.cos(x)<\/p>\n<h2><strong>\u521b\u5efa\u56fe\u5f62\u5bf9\u8c61<\/strong><\/h2>\n<p>fig, ax = plt.subplots()<\/p>\n<h2><strong>\u7ed8\u5236\u66f2\u7ebf<\/strong><\/h2>\n<p>ax.plot(x, y1, label=&#39;sin(x)&#39;)<\/p>\n<p>ax.plot(x, y2, label=&#39;cos(x)&#39;)<\/p>\n<h2><strong>\u586b\u5145\u4e24\u4e2a\u66f2\u7ebf\u4e4b\u95f4\u7684\u533a\u57df<\/strong><\/h2>\n<p>ax.fill_between(x, y1, y2, where=(y2 &gt; y1), facecolor=&#39;green&#39;, alpha=0.5, interpolate=True)<\/p>\n<p>ax.fill_between(x, y1, y2, where=(y2 &lt;= y1), facecolor=&#39;red&#39;, alpha=0.5, interpolate=True)<\/p>\n<h2><strong>\u6dfb\u52a0\u56fe\u4f8b<\/strong><\/h2>\n<p>ax.legend()<\/p>\n<h2><strong>\u663e\u793a\u56fe\u5f62<\/strong><\/h2>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u9996\u5148\u751f\u6210\u4e86\u6570\u636e\uff0c\u7136\u540e\u4f7f\u7528<code>plot<\/code>\u51fd\u6570\u7ed8\u5236\u4e86\u4e24\u6761\u66f2\u7ebf\u3002\u63a5\u7740\uff0c\u6211\u4eec\u4f7f\u7528<code>fill_between<\/code>\u51fd\u6570\u586b\u5145\u4e86\u4e24\u6761\u66f2\u7ebf\u4e4b\u95f4\u7684\u533a\u57df\uff0c\u5206\u522b\u4f7f\u7528\u7eff\u8272\u548c\u7ea2\u8272\u6765\u8868\u793a\u4e0d\u540c\u7684\u533a\u57df\u3002\u6700\u540e\uff0c\u6211\u4eec\u6dfb\u52a0\u4e86\u56fe\u4f8b\u5e76\u663e\u793a\u4e86\u56fe\u5f62\u3002<\/p>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5728Python\u4e2d\u4f7f\u7528\u4e0d\u540c\u5e93\u586b\u5145\u989c\u8272\u7684\u5176\u4ed6\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><h2>\u4e00\u3001\u4f7f\u7528matplotlib\u586b\u5145\u989c\u8272<\/h2>\n<\/p>\n<p><h3>1. \u586b\u5145\u4e24\u4e2a\u66f2\u7ebf\u4e4b\u95f4\u7684\u533a\u57df<\/h3>\n<\/p>\n<p><p>\u5728matplotlib\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>fill_between<\/code>\u51fd\u6570\u586b\u5145\u4e24\u4e2a\u66f2\u7ebf\u4e4b\u95f4\u7684\u533a\u57df\u3002<code>fill_between<\/code>\u51fd\u6570\u7684\u57fa\u672c\u7528\u6cd5\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">ax.fill_between(x, y1, y2, where, facecolor, alpha, interpolate)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ul>\n<li><code>x<\/code>\uff1ax\u8f74\u6570\u636e\u3002<\/li>\n<li><code>y1<\/code>\uff1a\u7b2c\u4e00\u6761\u66f2\u7ebf\u7684y\u8f74\u6570\u636e\u3002<\/li>\n<li><code>y2<\/code>\uff1a\u7b2c\u4e8c\u6761\u66f2\u7ebf\u7684y\u8f74\u6570\u636e\u3002<\/li>\n<li><code>where<\/code>\uff1a\u4e00\u4e2a\u5e03\u5c14\u6570\u7ec4\uff0c\u7528\u4e8e\u6307\u5b9a\u586b\u5145\u533a\u57df\u3002<\/li>\n<li><code>facecolor<\/code>\uff1a\u586b\u5145\u989c\u8272\u3002<\/li>\n<li><code>alpha<\/code>\uff1a\u900f\u660e\u5ea6\u3002<\/li>\n<li><code>interpolate<\/code>\uff1a\u662f\u5426\u63d2\u503c\u3002<\/li>\n<\/ul>\n<p><h3>2. \u586b\u5145\u66f2\u7ebf\u5230x\u8f74\u4e4b\u95f4\u7684\u533a\u57df<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>fill_between<\/code>\u51fd\u6570\u586b\u5145\u66f2\u7ebf\u5230x\u8f74\u4e4b\u95f4\u7684\u533a\u57df\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<p>import numpy as np<\/p>\n<h2><strong>\u751f\u6210\u6570\u636e<\/strong><\/h2>\n<p>x = np.linspace(0, 2 * np.pi, 100)<\/p>\n<p>y = np.sin(x)<\/p>\n<h2><strong>\u521b\u5efa\u56fe\u5f62\u5bf9\u8c61<\/strong><\/h2>\n<p>fig, ax = plt.subplots()<\/p>\n<h2><strong>\u7ed8\u5236\u66f2\u7ebf<\/strong><\/h2>\n<p>ax.plot(x, y, label=&#39;sin(x)&#39;)<\/p>\n<h2><strong>\u586b\u5145\u66f2\u7ebf\u5230x\u8f74\u4e4b\u95f4\u7684\u533a\u57df<\/strong><\/h2>\n<p>ax.fill_between(x, y, 0, facecolor=&#39;blue&#39;, alpha=0.3)<\/p>\n<h2><strong>\u6dfb\u52a0\u56fe\u4f8b<\/strong><\/h2>\n<p>ax.legend()<\/p>\n<h2><strong>\u663e\u793a\u56fe\u5f62<\/strong><\/h2>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>fill_between<\/code>\u51fd\u6570\u586b\u5145\u4e86\u66f2\u7ebf\u5230x\u8f74\u4e4b\u95f4\u7684\u533a\u57df\uff0c\u4f7f\u7528\u84dd\u8272\u8868\u793a\u586b\u5145\u533a\u57df\u3002<\/p>\n<\/p>\n<p><h3>3. \u586b\u5145\u67f1\u72b6\u56fe\u7684\u989c\u8272<\/h3>\n<\/p>\n<p><p>\u5728matplotlib\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>bar<\/code>\u51fd\u6570\u7ed8\u5236\u67f1\u72b6\u56fe\uff0c\u5e76\u4f7f\u7528<code>color<\/code>\u53c2\u6570\u586b\u5145\u67f1\u72b6\u56fe\u7684\u989c\u8272\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<h2><strong>\u6570\u636e<\/strong><\/h2>\n<p>categories = [&#39;A&#39;, &#39;B&#39;, &#39;C&#39;, &#39;D&#39;]<\/p>\n<p>values = [10, 15, 7, 12]<\/p>\n<h2><strong>\u521b\u5efa\u56fe\u5f62\u5bf9\u8c61<\/strong><\/h2>\n<p>fig, ax = plt.subplots()<\/p>\n<h2><strong>\u7ed8\u5236\u67f1\u72b6\u56fe<\/strong><\/h2>\n<p>ax.bar(categories, values, color=[&#39;red&#39;, &#39;blue&#39;, &#39;green&#39;, &#39;purple&#39;])<\/p>\n<h2><strong>\u663e\u793a\u56fe\u5f62<\/strong><\/h2>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>bar<\/code>\u51fd\u6570\u7ed8\u5236\u4e86\u67f1\u72b6\u56fe\uff0c\u5e76\u4f7f\u7528\u4e0d\u540c\u7684\u989c\u8272\u586b\u5145\u6bcf\u4e2a\u67f1\u5b50\u3002<\/p>\n<\/p>\n<p><h2>\u4e8c\u3001\u4f7f\u7528PIL\u586b\u5145\u989c\u8272<\/h2>\n<\/p>\n<p><p>PIL\uff08Python Imaging Library\uff09\u662f\u4e00\u4e2a\u7528\u4e8e\u56fe\u50cf\u5904\u7406\u7684\u5e93\uff0c\u53ef\u4ee5\u7528\u6765\u586b\u5145\u56fe\u50cf\u7684\u989c\u8272\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528PIL\u586b\u5145\u989c\u8272\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from PIL import Image, ImageDraw<\/p>\n<h2><strong>\u521b\u5efa\u7a7a\u767d\u56fe\u50cf<\/strong><\/h2>\n<p>image = Image.new(&#39;RGB&#39;, (200, 200), &#39;white&#39;)<\/p>\n<p>draw = ImageDraw.Draw(image)<\/p>\n<h2><strong>\u586b\u5145\u77e9\u5f62\u533a\u57df<\/strong><\/h2>\n<p>draw.rectangle([50, 50, 150, 150], fill=&#39;blue&#39;)<\/p>\n<h2><strong>\u663e\u793a\u56fe\u50cf<\/strong><\/h2>\n<p>image.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u9996\u5148\u521b\u5efa\u4e86\u4e00\u4e2a\u7a7a\u767d\u56fe\u50cf\uff0c\u7136\u540e\u4f7f\u7528<code>ImageDraw<\/code>\u5bf9\u8c61\u586b\u5145\u4e86\u4e00\u4e2a\u77e9\u5f62\u533a\u57df\uff0c\u6700\u540e\u663e\u793a\u4e86\u56fe\u50cf\u3002<\/p>\n<\/p>\n<p><h3>1. \u586b\u5145\u692d\u5706\u533a\u57df<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>ellipse<\/code>\u65b9\u6cd5\u586b\u5145\u692d\u5706\u533a\u57df\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from PIL import Image, ImageDraw<\/p>\n<h2><strong>\u521b\u5efa\u7a7a\u767d\u56fe\u50cf<\/strong><\/h2>\n<p>image = Image.new(&#39;RGB&#39;, (200, 200), &#39;white&#39;)<\/p>\n<p>draw = ImageDraw.Draw(image)<\/p>\n<h2><strong>\u586b\u5145\u692d\u5706\u533a\u57df<\/strong><\/h2>\n<p>draw.ellipse([50, 50, 150, 150], fill=&#39;green&#39;)<\/p>\n<h2><strong>\u663e\u793a\u56fe\u50cf<\/strong><\/h2>\n<p>image.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>ellipse<\/code>\u65b9\u6cd5\u586b\u5145\u4e86\u4e00\u4e2a\u692d\u5706\u533a\u57df\uff0c\u4f7f\u7528\u7eff\u8272\u8868\u793a\u586b\u5145\u533a\u57df\u3002<\/p>\n<\/p>\n<p><h3>2. \u586b\u5145\u591a\u8fb9\u5f62\u533a\u57df<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>polygon<\/code>\u65b9\u6cd5\u586b\u5145\u591a\u8fb9\u5f62\u533a\u57df\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from PIL import Image, ImageDraw<\/p>\n<h2><strong>\u521b\u5efa\u7a7a\u767d\u56fe\u50cf<\/strong><\/h2>\n<p>image = Image.new(&#39;RGB&#39;, (200, 200), &#39;white&#39;)<\/p>\n<p>draw = ImageDraw.Draw(image)<\/p>\n<h2><strong>\u586b\u5145\u591a\u8fb9\u5f62\u533a\u57df<\/strong><\/h2>\n<p>draw.polygon([(50, 50), (150, 50), (100, 150)], fill=&#39;red&#39;)<\/p>\n<h2><strong>\u663e\u793a\u56fe\u50cf<\/strong><\/h2>\n<p>image.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>polygon<\/code>\u65b9\u6cd5\u586b\u5145\u4e86\u4e00\u4e2a\u591a\u8fb9\u5f62\u533a\u57df\uff0c\u4f7f\u7528\u7ea2\u8272\u8868\u793a\u586b\u5145\u533a\u57df\u3002<\/p>\n<\/p>\n<p><h2>\u4e09\u3001\u4f7f\u7528OpenCV\u586b\u5145\u989c\u8272<\/h2>\n<\/p>\n<p><p>OpenCV\u662f\u4e00\u4e2a\u7528\u4e8e\u8ba1\u7b97\u673a\u89c6\u89c9\u7684\u5e93\uff0c\u53ef\u4ee5\u7528\u6765\u586b\u5145\u56fe\u50cf\u7684\u989c\u8272\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528OpenCV\u586b\u5145\u989c\u8272\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import cv2<\/p>\n<p>import numpy as np<\/p>\n<h2><strong>\u521b\u5efa\u7a7a\u767d\u56fe\u50cf<\/strong><\/h2>\n<p>image = np.zeros((200, 200, 3), dtype=np.uint8)<\/p>\n<h2><strong>\u586b\u5145\u77e9\u5f62\u533a\u57df<\/strong><\/h2>\n<p>cv2.rectangle(image, (50, 50), (150, 150), (255, 0, 0), -1)<\/p>\n<h2><strong>\u663e\u793a\u56fe\u50cf<\/strong><\/h2>\n<p>cv2.imshow(&#39;image&#39;, image)<\/p>\n<p>cv2.w<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>tKey(0)<\/p>\n<p>cv2.destroyAllWindows()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u9996\u5148\u521b\u5efa\u4e86\u4e00\u4e2a\u7a7a\u767d\u56fe\u50cf\uff0c\u7136\u540e\u4f7f\u7528<code>rectangle<\/code>\u65b9\u6cd5\u586b\u5145\u4e86\u4e00\u4e2a\u77e9\u5f62\u533a\u57df\uff0c\u6700\u540e\u663e\u793a\u4e86\u56fe\u50cf\u3002<\/p>\n<\/p>\n<p><h3>1. \u586b\u5145\u5706\u5f62\u533a\u57df<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>circle<\/code>\u65b9\u6cd5\u586b\u5145\u5706\u5f62\u533a\u57df\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import cv2<\/p>\n<p>import numpy as np<\/p>\n<h2><strong>\u521b\u5efa\u7a7a\u767d\u56fe\u50cf<\/strong><\/h2>\n<p>image = np.zeros((200, 200, 3), dtype=np.uint8)<\/p>\n<h2><strong>\u586b\u5145\u5706\u5f62\u533a\u57df<\/strong><\/h2>\n<p>cv2.circle(image, (100, 100), 50, (0, 255, 0), -1)<\/p>\n<h2><strong>\u663e\u793a\u56fe\u50cf<\/strong><\/h2>\n<p>cv2.imshow(&#39;image&#39;, image)<\/p>\n<p>cv2.waitKey(0)<\/p>\n<p>cv2.destroyAllWindows()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>circle<\/code>\u65b9\u6cd5\u586b\u5145\u4e86\u4e00\u4e2a\u5706\u5f62\u533a\u57df\uff0c\u4f7f\u7528\u7eff\u8272\u8868\u793a\u586b\u5145\u533a\u57df\u3002<\/p>\n<\/p>\n<p><h3>2. \u586b\u5145\u591a\u8fb9\u5f62\u533a\u57df<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>fillPoly<\/code>\u65b9\u6cd5\u586b\u5145\u591a\u8fb9\u5f62\u533a\u57df\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import cv2<\/p>\n<p>import numpy as np<\/p>\n<h2><strong>\u521b\u5efa\u7a7a\u767d\u56fe\u50cf<\/strong><\/h2>\n<p>image = np.zeros((200, 200, 3), dtype=np.uint8)<\/p>\n<h2><strong>\u586b\u5145\u591a\u8fb9\u5f62\u533a\u57df<\/strong><\/h2>\n<p>points = np.array([[50, 50], [150, 50], [100, 150]], dtype=np.int32)<\/p>\n<p>cv2.fillPoly(image, [points], (0, 0, 255))<\/p>\n<h2><strong>\u663e\u793a\u56fe\u50cf<\/strong><\/h2>\n<p>cv2.imshow(&#39;image&#39;, image)<\/p>\n<p>cv2.waitKey(0)<\/p>\n<p>cv2.destroyAllWindows()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>fillPoly<\/code>\u65b9\u6cd5\u586b\u5145\u4e86\u4e00\u4e2a\u591a\u8fb9\u5f62\u533a\u57df\uff0c\u4f7f\u7528\u7ea2\u8272\u8868\u793a\u586b\u5145\u533a\u57df\u3002<\/p>\n<\/p>\n<p><h2>\u56db\u3001\u4f7f\u7528turtle\u586b\u5145\u989c\u8272<\/h2>\n<\/p>\n<p><p>turtle\u662fPython\u7684\u4e00\u4e2a\u6807\u51c6\u5e93\uff0c\u53ef\u4ee5\u7528\u4e8e\u7ed8\u5236\u56fe\u5f62\u548c\u586b\u5145\u989c\u8272\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528turtle\u586b\u5145\u989c\u8272\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import turtle<\/p>\n<h2><strong>\u8bbe\u7f6e\u7a97\u53e3\u5927\u5c0f<\/strong><\/h2>\n<p>turtle.setup(400, 400)<\/p>\n<h2><strong>\u8bbe\u7f6e\u586b\u5145\u989c\u8272<\/strong><\/h2>\n<p>turtle.fillcolor(&#39;blue&#39;)<\/p>\n<h2><strong>\u5f00\u59cb\u586b\u5145<\/strong><\/h2>\n<p>turtle.begin_fill()<\/p>\n<h2><strong>\u7ed8\u5236\u77e9\u5f62<\/strong><\/h2>\n<p>turtle.forward(100)<\/p>\n<p>turtle.left(90)<\/p>\n<p>turtle.forward(100)<\/p>\n<p>turtle.left(90)<\/p>\n<p>turtle.forward(100)<\/p>\n<p>turtle.left(90)<\/p>\n<p>turtle.forward(100)<\/p>\n<p>turtle.left(90)<\/p>\n<h2><strong>\u7ed3\u675f\u586b\u5145<\/strong><\/h2>\n<p>turtle.end_fill()<\/p>\n<h2><strong>\u9690\u85cf\u6d77\u9f9f<\/strong><\/h2>\n<p>turtle.hideturtle()<\/p>\n<h2><strong>\u663e\u793a\u7a97\u53e3<\/strong><\/h2>\n<p>turtle.done()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528turtle\u5e93\u7ed8\u5236\u4e86\u4e00\u4e2a\u77e9\u5f62\uff0c\u5e76\u586b\u5145\u4e86\u84dd\u8272\u3002<\/p>\n<\/p>\n<p><h3>1. \u586b\u5145\u5706\u5f62\u533a\u57df<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>turtle.circle<\/code>\u65b9\u6cd5\u586b\u5145\u5706\u5f62\u533a\u57df\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import turtle<\/p>\n<h2><strong>\u8bbe\u7f6e\u7a97\u53e3\u5927\u5c0f<\/strong><\/h2>\n<p>turtle.setup(400, 400)<\/p>\n<h2><strong>\u8bbe\u7f6e\u586b\u5145\u989c\u8272<\/strong><\/h2>\n<p>turtle.fillcolor(&#39;green&#39;)<\/p>\n<h2><strong>\u5f00\u59cb\u586b\u5145<\/strong><\/h2>\n<p>turtle.begin_fill()<\/p>\n<h2><strong>\u7ed8\u5236\u5706\u5f62<\/strong><\/h2>\n<p>turtle.circle(50)<\/p>\n<h2><strong>\u7ed3\u675f\u586b\u5145<\/strong><\/h2>\n<p>turtle.end_fill()<\/p>\n<h2><strong>\u9690\u85cf\u6d77\u9f9f<\/strong><\/h2>\n<p>turtle.hideturtle()<\/p>\n<h2><strong>\u663e\u793a\u7a97\u53e3<\/strong><\/h2>\n<p>turtle.done()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>turtle.circle<\/code>\u65b9\u6cd5\u7ed8\u5236\u4e86\u4e00\u4e2a\u5706\u5f62\uff0c\u5e76\u586b\u5145\u4e86\u7eff\u8272\u3002<\/p>\n<\/p>\n<p><h3>2. \u586b\u5145\u591a\u8fb9\u5f62\u533a\u57df<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>turtle.goto<\/code>\u65b9\u6cd5\u7ed8\u5236\u591a\u8fb9\u5f62\uff0c\u5e76\u586b\u5145\u989c\u8272\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import turtle<\/p>\n<h2><strong>\u8bbe\u7f6e\u7a97\u53e3\u5927\u5c0f<\/strong><\/h2>\n<p>turtle.setup(400, 400)<\/p>\n<h2><strong>\u8bbe\u7f6e\u586b\u5145\u989c\u8272<\/strong><\/h2>\n<p>turtle.fillcolor(&#39;red&#39;)<\/p>\n<h2><strong>\u5f00\u59cb\u586b\u5145<\/strong><\/h2>\n<p>turtle.begin_fill()<\/p>\n<h2><strong>\u7ed8\u5236\u591a\u8fb9\u5f62<\/strong><\/h2>\n<p>turtle.goto(50, 50)<\/p>\n<p>turtle.goto(150, 50)<\/p>\n<p>turtle.goto(100, 150)<\/p>\n<p>turtle.goto(0, 0)<\/p>\n<h2><strong>\u7ed3\u675f\u586b\u5145<\/strong><\/h2>\n<p>turtle.end_fill()<\/p>\n<h2><strong>\u9690\u85cf\u6d77\u9f9f<\/strong><\/h2>\n<p>turtle.hideturtle()<\/p>\n<h2><strong>\u663e\u793a\u7a97\u53e3<\/strong><\/h2>\n<p>turtle.done()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>turtle.goto<\/code>\u65b9\u6cd5\u7ed8\u5236\u4e86\u4e00\u4e2a\u591a\u8fb9\u5f62\uff0c\u5e76\u586b\u5145\u4e86\u7ea2\u8272\u3002<\/p>\n<\/p>\n<p><h2>\u4e94\u3001\u4f7f\u7528SVG\u586b\u5145\u989c\u8272<\/h2>\n<\/p>\n<p><p>SVG\uff08Scalable Vector Graphics\uff09\u662f\u4e00\u79cd\u7528\u4e8e\u63cf\u8ff0\u4e8c\u7ef4\u77e2\u91cf\u56fe\u5f62\u7684XML\u683c\u5f0f\uff0c\u53ef\u4ee5\u4f7f\u7528Python\u4e2d\u7684<code>svgwrite<\/code>\u5e93\u6765\u521b\u5efa\u548c\u586b\u5145SVG\u56fe\u5f62\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528<code>svgwrite<\/code>\u586b\u5145\u989c\u8272\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import svgwrite<\/p>\n<h2><strong>\u521b\u5efaSVG\u6587\u6863<\/strong><\/h2>\n<p>dwg = svgwrite.Drawing(&#39;example.svg&#39;, profile=&#39;tiny&#39;)<\/p>\n<h2><strong>\u586b\u5145\u77e9\u5f62\u533a\u57df<\/strong><\/h2>\n<p>dwg.add(dwg.rect(insert=(50, 50), size=(100, 100), fill=&#39;blue&#39;))<\/p>\n<h2><strong>\u4fdd\u5b58SVG\u6587\u6863<\/strong><\/h2>\n<p>dwg.save()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>svgwrite<\/code>\u5e93\u521b\u5efa\u4e86\u4e00\u4e2aSVG\u6587\u6863\uff0c\u5e76\u586b\u5145\u4e86\u4e00\u4e2a\u84dd\u8272\u77e9\u5f62\u533a\u57df\u3002<\/p>\n<\/p>\n<p><h3>1. \u586b\u5145\u5706\u5f62\u533a\u57df<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>circle<\/code>\u65b9\u6cd5\u586b\u5145\u5706\u5f62\u533a\u57df\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import svgwrite<\/p>\n<h2><strong>\u521b\u5efaSVG\u6587\u6863<\/strong><\/h2>\n<p>dwg = svgwrite.Drawing(&#39;example.svg&#39;, profile=&#39;tiny&#39;)<\/p>\n<h2><strong>\u586b\u5145\u5706\u5f62\u533a\u57df<\/strong><\/h2>\n<p>dwg.add(dwg.circle(center=(100, 100), r=50, fill=&#39;green&#39;))<\/p>\n<h2><strong>\u4fdd\u5b58SVG\u6587\u6863<\/strong><\/h2>\n<p>dwg.save()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>circle<\/code>\u65b9\u6cd5\u586b\u5145\u4e86\u4e00\u4e2a\u7eff\u8272\u5706\u5f62\u533a\u57df\u3002<\/p>\n<\/p>\n<p><h3>2. \u586b\u5145\u591a\u8fb9\u5f62\u533a\u57df<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>polygon<\/code>\u65b9\u6cd5\u586b\u5145\u591a\u8fb9\u5f62\u533a\u57df\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import svgwrite<\/p>\n<h2><strong>\u521b\u5efaSVG\u6587\u6863<\/strong><\/h2>\n<p>dwg = svgwrite.Drawing(&#39;example.svg&#39;, profile=&#39;tiny&#39;)<\/p>\n<h2><strong>\u586b\u5145\u591a\u8fb9\u5f62\u533a\u57df<\/strong><\/h2>\n<p>points = [(50, 50), (150, 50), (100, 150)]<\/p>\n<p>dwg.add(dwg.polygon(points, fill=&#39;red&#39;))<\/p>\n<h2><strong>\u4fdd\u5b58SVG\u6587\u6863<\/strong><\/h2>\n<p>dwg.save()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>polygon<\/code>\u65b9\u6cd5\u586b\u5145\u4e86\u4e00\u4e2a\u7ea2\u8272\u591a\u8fb9\u5f62\u533a\u57df\u3002<\/p>\n<\/p>\n<p><h2>\u516d\u3001\u4f7f\u7528pygame\u586b\u5145\u989c\u8272<\/h2>\n<\/p>\n<p><p>pygame\u662f\u4e00\u4e2a\u7528\u4e8e\u7f16\u5199\u6e38\u620f\u7684Python\u5e93\uff0c\u53ef\u4ee5\u7528\u6765\u586b\u5145\u56fe\u50cf\u7684\u989c\u8272\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528pygame\u586b\u5145\u989c\u8272\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pygame<\/p>\n<h2><strong>\u521d\u59cb\u5316pygame<\/strong><\/h2>\n<p>pygame.init()<\/p>\n<h2><strong>\u8bbe\u7f6e\u7a97\u53e3\u5927\u5c0f<\/strong><\/h2>\n<p>screen = pygame.display.set_mode((400, 400))<\/p>\n<h2><strong>\u8bbe\u7f6e\u586b\u5145\u989c\u8272<\/strong><\/h2>\n<p>color = (0, 0, 255)<\/p>\n<h2><strong>\u586b\u5145\u77e9\u5f62\u533a\u57df<\/strong><\/h2>\n<p>pygame.draw.rect(screen, color, pygame.Rect(50, 50, 100, 100))<\/p>\n<h2><strong>\u5237\u65b0\u5c4f\u5e55<\/strong><\/h2>\n<p>pygame.display.flip()<\/p>\n<h2><strong>\u7b49\u5f85\u9000\u51fa<\/strong><\/h2>\n<p>running = True<\/p>\n<p>while running:<\/p>\n<p>    for event in pygame.event.get():<\/p>\n<p>        if event.type == pygame.QUIT:<\/p>\n<p>            running = False<\/p>\n<h2><strong>\u9000\u51fapygame<\/strong><\/h2>\n<p>pygame.quit()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528pygame\u5e93\u521b\u5efa\u4e86\u4e00\u4e2a\u7a97\u53e3\uff0c\u5e76\u586b\u5145\u4e86\u4e00\u4e2a\u84dd\u8272\u77e9\u5f62\u533a\u57df\u3002<\/p>\n<\/p>\n<p><h3>1. \u586b\u5145\u5706\u5f62\u533a\u57df<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>pygame.draw.circle<\/code>\u65b9\u6cd5\u586b\u5145\u5706\u5f62\u533a\u57df\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pygame<\/p>\n<h2><strong>\u521d\u59cb\u5316pygame<\/strong><\/h2>\n<p>pygame.init()<\/p>\n<h2><strong>\u8bbe\u7f6e\u7a97\u53e3\u5927\u5c0f<\/strong><\/h2>\n<p>screen = pygame.display.set_mode((400, 400))<\/p>\n<h2><strong>\u8bbe\u7f6e\u586b\u5145\u989c\u8272<\/strong><\/h2>\n<p>color = (0, 255, 0)<\/p>\n<h2><strong>\u586b\u5145\u5706\u5f62\u533a\u57df<\/strong><\/h2>\n<p>pygame.draw.circle(screen, color, (200, 200), 50)<\/p>\n<h2><strong>\u5237\u65b0\u5c4f\u5e55<\/strong><\/h2>\n<p>pygame.display.flip()<\/p>\n<h2><strong>\u7b49\u5f85\u9000\u51fa<\/strong><\/h2>\n<p>running = True<\/p>\n<p>while running:<\/p>\n<p>    for event in pygame.event.get():<\/p>\n<p>        if event.type == pygame.QUIT:<\/p>\n<p>            running = False<\/p>\n<h2><strong>\u9000\u51fapygame<\/strong><\/h2>\n<p>pygame.quit()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>pygame.draw.circle<\/code>\u65b9\u6cd5\u586b\u5145\u4e86\u4e00\u4e2a\u7eff\u8272\u5706\u5f62\u533a\u57df\u3002<\/p>\n<\/p>\n<p><h3>2. \u586b\u5145\u591a\u8fb9\u5f62\u533a\u57df<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>pygame.draw.polygon<\/code>\u65b9\u6cd5\u586b\u5145\u591a\u8fb9\u5f62\u533a\u57df\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pygame<\/p>\n<h2><strong>\u521d\u59cb\u5316pygame<\/strong><\/h2>\n<p>pygame.init()<\/p>\n<h2><strong>\u8bbe\u7f6e\u7a97\u53e3\u5927\u5c0f<\/strong><\/h2>\n<p>screen = pygame.display.set_mode((400, 400))<\/p>\n<h2><strong>\u8bbe\u7f6e\u586b\u5145\u989c\u8272<\/strong><\/h2>\n<p>color = (255, 0, 0)<\/p>\n<h2><strong>\u586b\u5145\u591a\u8fb9\u5f62\u533a\u57df<\/strong><\/h2>\n<p>points = [(100, 100), (300, 100), (200, 300)]<\/p>\n<p>pygame.draw.polygon(screen, color, points)<\/p>\n<h2><strong>\u5237\u65b0\u5c4f\u5e55<\/strong><\/h2>\n<p>pygame.display.flip()<\/p>\n<h2><strong>\u7b49\u5f85\u9000\u51fa<\/strong><\/h2>\n<p>running = True<\/p>\n<p>while running:<\/p>\n<p>    for event in pygame.event.get():<\/p>\n<p>        if event.type == pygame.QUIT:<\/p>\n<p>            running = False<\/p>\n<h2><strong>\u9000\u51fapygame<\/strong><\/h2>\n<p>pygame.quit()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>pygame.draw.polygon<\/code>\u65b9\u6cd5\u586b\u5145\u4e86\u4e00\u4e2a\u7ea2\u8272\u591a\u8fb9\u5f62\u533a\u57df\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u793a\u4f8b\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u5230\uff0c\u5728Python\u4e2d\u6709\u591a\u79cd\u5e93\u53ef\u4ee5\u7528\u6765\u586b\u5145\u989c\u8272\uff0c\u5305\u62ecmatplotlib\u3001PIL\u3001OpenCV\u3001turtle\u3001SVG\u3001pygame\u7b49\u3002\u6839\u636e\u5177\u4f53\u7684\u5e94\u7528\u573a\u666f\u548c\u9700\u6c42\uff0c\u9009\u62e9\u5408\u9002\u7684\u5e93\u8fdb\u884c\u989c\u8272\u586b\u5145\uff0c\u80fd\u591f\u5e2e\u52a9\u6211\u4eec\u5b9e\u73b0\u4e0d\u540c\u7684\u56fe\u5f62\u548c\u56fe\u50cf\u6548\u679c\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u4f7f\u7528\u989c\u8272\u4ee3\u7801\u586b\u5145\u56fe\u5f62\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2a\u5e93\u6765\u586b\u5145\u989c\u8272\uff0c\u4f8b\u5982Matplotlib\u548cPygame\u3002\u4f7f\u7528Matplotlib\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7<code>fill<\/code>\u6216<code>scatter<\/code>\u51fd\u6570\u6307\u5b9a\u989c\u8272\u4ee3\u7801\u8fdb\u884c\u586b\u5145\u3002\u4f8b\u5982\uff0c<code>plt.fill(x, y, color=&#39;#FF5733&#39;)<\/code>\u53ef\u4ee5\u7528\u5341\u516d\u8fdb\u5236\u989c\u8272\u4ee3\u7801\u586b\u5145\u56fe\u5f62\u3002\u5728Pygame\u4e2d\uff0c\u4f7f\u7528<code>pygame.draw.rect<\/code>\u7b49\u51fd\u6570\u65f6\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f20\u5165\u989c\u8272\u4ee3\u7801\u4f5c\u4e3aRGB\u5143\u7ec4\uff0c\u4f8b\u5982<code>(255, 87, 51)<\/code>\u3002<\/p>\n<p><strong>\u5728Python\u4e2d\u83b7\u53d6\u989c\u8272\u4ee3\u7801\u7684\u6700\u4f73\u5b9e\u8df5\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>\u83b7\u53d6\u989c\u8272\u4ee3\u7801\u7684\u6700\u4f73\u5b9e\u8df5\u5305\u62ec\u4f7f\u7528\u989c\u8272\u9009\u62e9\u5668\u5de5\u5177\u6216\u5728\u7ebf\u8272\u5f69\u7ba1\u7406\u5de5\u5177\u3002\u53ef\u4ee5\u4f7f\u7528RGB\u3001\u5341\u516d\u8fdb\u5236\u6216HSL\u7b49\u4e0d\u540c\u683c\u5f0f\u6765\u8868\u793a\u989c\u8272\u3002\u5bf9\u4e8eWeb\u5f00\u53d1\uff0c\u5341\u516d\u8fdb\u5236\u989c\u8272\u4ee3\u7801\u66f4\u4e3a\u5e38\u89c1\uff0c\u800c\u5728\u56fe\u5f62\u5904\u7406\u65f6\uff0cRGB\u683c\u5f0f\u66f4\u4e3a\u76f4\u89c2\u3002\u6b64\u5916\uff0c\u4f7f\u7528\u547d\u540d\u989c\u8272\uff08\u5982&#39;red&#39;\u3001&#39;blue&#39;\uff09\u4e5f\u662f\u4e00\u79cd\u65b9\u4fbf\u7684\u65b9\u6cd5\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Python\u4e2d\u521b\u5efa\u81ea\u5b9a\u4e49\u989c\u8272\u8c03\u8272\u677f\uff1f<\/strong><br \/>\u8981\u521b\u5efa\u81ea\u5b9a\u4e49\u989c\u8272\u8c03\u8272\u677f\uff0c\u53ef\u4ee5\u4f7f\u7528<code>matplotlib.colors<\/code>\u6a21\u5757\u4e2d\u7684<code>LinearSegmentedColormap<\/code>\u7c7b\u3002\u901a\u8fc7\u5b9a\u4e49\u4e00\u4e2a\u989c\u8272\u5217\u8868\uff0c\u53ef\u4ee5\u8f7b\u677e\u521b\u5efa\u6e10\u53d8\u989c\u8272\u8c03\u8272\u677f\u3002\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a  <\/p>\n<pre><code class=\"language-python\">import matplotlib.pyplot as plt\nfrom matplotlib.colors import LinearSegmentedColormap\n\ncolors = [&#39;#FF5733&#39;, &#39;#33FF57&#39;, &#39;#3357FF&#39;]\ncustom_cmap = LinearSegmentedColormap.from_list(&#39;custom_palette&#39;, colors)\nplt.imshow([[0, 1]], cmap=custom_cmap)\nplt.show()\n<\/code><\/pre>\n<p>\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u8ba9\u60a8\u6839\u636e\u9700\u8981\u7075\u6d3b\u8bbe\u8ba1\u914d\u8272\u65b9\u6848\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u5728Python\u4e2d\u586b\u5145\u989c\u8272\u4ee3\u7801\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u79cd\u65b9\u6cd5\u548c\u5e93\uff0c\u4f8b\u5982matplotlib\u3001PIL\u3001OpenCV\u7b49\u3002 \u9996\u5148 [&hellip;]","protected":false},"author":3,"featured_media":1186342,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1186334"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1186334"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1186334\/revisions"}],"predecessor-version":[{"id":1186346,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1186334\/revisions\/1186346"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1186342"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1186334"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1186334"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1186334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}