{"id":171578,"date":"2022-04-18T08:01:01","date_gmt":"2022-04-18T00:01:01","guid":{"rendered":"http:\/\/www.idc.net\/help\/171578\/"},"modified":"2022-04-18T08:01:01","modified_gmt":"2022-04-18T00:01:01","slug":"%e5%90%8e%e6%b5%aa%e4%ba%91python%e6%95%99%e7%a8%8b%ef%bc%9a%e5%a6%82%e4%bd%95%e7%94%a8python%e7%94%bb%e6%9e%81%e5%9d%90%e6%a0%87%e6%9f%b1%e7%8a%b6%e5%9b%be%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/171578\/","title":{"rendered":"\u540e\u6d6a\u4e91Python\u6559\u7a0b\uff1a\u5982\u4f55\u7528python\u753b\u6781\u5750\u6807\u67f1\u72b6\u56fe\uff1f"},"content":{"rendered":"<p style=\"text-align: justify;line-height: 1.75em\"><span style=\"font-size: 14px\">\u4e4b\u524d\u6211\u4eec\u8bb2\u8fc7\u6781\u5750\u6807\u6563\u70b9\u56fe\uff0c\u4e0d\u77e5\u9053\u5927\u5bb6\u8fd8\u6709\u5370\u8c61\u6ca1\uff1f\u4eca\u5929\u4e3a\u5927\u5bb6\u5e26\u6765\u6781\u5750\u6807\u67f1\u72b6\u56fe\uff0c\u4e00\u8d77\u6765\u5b66\u4e60\u4e0b\u5427~<\/span><\/p>\n<p style=\"text-align: justify;line-height: 1.75em\"><span style=\"font-size: 14px\"><br \/><\/span><\/p>\n<p style=\"text-align: justify;line-height: 1.75em\"><span style=\"font-size: 14px\">\u67f1\u72b6\u56fe\u662f\u4e00\u79cd\u4ee5\u957f\u65b9\u5f62\u957f\u5ea6\u4e3a\u53d8\u91cf\u7684\u7edf\u8ba1\u62a5\u544a\u56fe\uff0c\u7531\u4e00\u7cfb\u5217\u9ad8\u5ea6\u4e0d\u7b49\u7684\u7eb5\u5411\u6761\u7eb9\u8868\u793a\u6570\u636e\u5206\u5e03\u7684\u60c5\u51b5\u3002\u6781\u5750\u6807\u67f1\u72b6\u56fe\u5219\u662f\u5c06\u67f1\u5f62\u6761\u663e\u793a\u5728\u6781\u5750\u6807\u4e2d\uff0c\u5176\u4e0d\u4ec5\u4fdd\u7559\u4e86\u76f4\u89d2\u5750\u6807\u7cfb\u4e2d\u6570\u636e\u53d8\u5316\u8d8b\u52bf\u7684\u4f18\u70b9\uff0c\u800c\u4e14\u56fe\u5f62\u8868\u8fbe\u5f62\u5f0f\u4e5f\u66f4\u52a0\u7f8e\u89c2\u3002<\/span><\/p>\n<pre>N&nbsp;=&nbsp;20\ntheta&nbsp;=&nbsp;np.linspace(0.0,&nbsp;2&nbsp;*&nbsp;np.pi,&nbsp;N,&nbsp;endpoint=False)\n#&nbsp;\u4ece0\u52302pi\u751f\u6210\u5747\u5300\u95f4\u9694\u768420\u4e2a\u6570\uff0cendpoint\u4e3aFlase\u8868\u793a\u4e0d\u5305\u542b\u672b\u5c3e\u6570\u5b572pi\uff0c\u9ed8\u8ba4\u4e3aTrue\uff0c\u8fd9\u91cc\u6307\u7684\u662f\u89d2\u5ea6\n&nbsp;\nR&nbsp;=&nbsp;10&nbsp;*&nbsp;np.random.rand(N)&nbsp;#&nbsp;\u968f\u673a\u751f\u621020\u4e2a\u534a\u5f84\nwidth&nbsp;=&nbsp;np.pi&nbsp;\/&nbsp;8&nbsp;*&nbsp;np.random.rand(N)&nbsp;#&nbsp;\u7ebf\u7684\u5bbd\u5ea6\nax&nbsp;=&nbsp;plt.subplot(111,&nbsp;projection&nbsp;=&nbsp;'polar')&nbsp;#&nbsp;\u6781\u5750\u6807\u56fe'polar'\nbars&nbsp;=&nbsp;ax.bar(theta,R,&nbsp;width&nbsp;=&nbsp;width,&nbsp;bottom&nbsp;=&nbsp;0.0)&nbsp;#&nbsp;\u7ed8\u5236\u67f1\u5b50\n&nbsp;\n#&nbsp;\u5229\u7528\u5faa\u73af\u8bbe\u7f6e\u6bcf\u4e2a\u67f1\u5b50\u7684\u989c\u8272\u3001\u900f\u660e\u5ea6\nfor&nbsp;r,&nbsp;bar&nbsp;in&nbsp;zip(radii,&nbsp;bars):&nbsp;bar.set_facecolor(plt.cm.viridis(r&nbsp;\/&nbsp;10.))&nbsp;#&nbsp;\u8bbe\u7f6e\u989c\u8272&nbsp;bar.set_alpha(0.5)&nbsp;#&nbsp;\u8bbe\u7f6e\u900f\u660e\u5ea6\nplt.show()<\/pre>\n<p style=\"text-align:justify\"><span style=\"font-size: 14px;font-family: \u5b8b\u4f53\"><\/span><\/p>\n<p style=\"text-align: justify;line-height: 1.75em\"><span style=\"font-size: 14px\">\u6240\u4f5c\u56fe\u5f62\u5982\u4e0b\u6240\u793a\uff0c\u53ef\u4ee5\u770b\u5230\uff0c\u56fe\u5f62\u53ef\u4ee5\u5f88\u6e05\u695a\u5730\u4f20\u8fbe\u6570\u636e\u7684\u5927\u5c0f\uff0c\u4e00\u5982\u4f60\u5728\u67f1\u72b6\u56fe\uff08\u6761\u5f62\u56fe\uff09\u4e0a\u770b\u5230\u7684\uff0c\u4f60\u8fd8\u53ef\u4ee5\u5c1d\u8bd5\u5728\u5706\u5916\u6dfb\u52a0\u6807\u7b7e\uff0c\u4f7f\u5f97\u67f1\u6761\u4e0e\u6807\u7b7e\u4e00\u4e00\u5bf9\u5e94\u8d77\u6765\uff08\u4e0d\u4f1a\u7684\u8bdd\u8bf7\u7ee7\u7eed\u9605\u8bfb\u4e0b\u6587\u6781\u5750\u6807\u96f7\u8fbe\u56fe\u7684\u7ed8\u5236\uff09\u3002<\/span><\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/oss.py.cn\/pycn\/upload\/image\/881\/137\/303\/1604742604440471.png\" class=\"aligncenter\"><\/p>\n<p style=\"line-height: 1.75em\"><span style=\"font-size: 14px\"><br \/><\/span><\/p>\n<p style=\"line-height: 1.75em\"><span style=\"font-size: 14px\">\u4ee5\u4e0a\u5c31\u662fpython\u753b\u6781\u5750\u6807\u67f1\u72b6\u56fe\u7684\u65b9\u6cd5\u3002<span style=\"font-size: 14px\">\u66f4\u591aPython\u5b66\u4e60\u63a8\u8350:<\/span><\/span><span style=\"font-size: 14px\">PyThon\u5b66\u4e60\u7f51\u6559\u5b66\u4e2d\u5fc3<\/span><span style=\"font-size: 14px\">\u3002<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e4b\u524d\u6211\u4eec\u8bb2\u8fc7\u6781\u5750\u6807\u6563\u70b9\u56fe\uff0c\u4e0d\u77e5\u9053\u5927\u5bb6\u8fd8\u6709\u5370\u8c61\u6ca1\uff1f\u4eca\u5929\u4e3a\u5927\u5bb6\u5e26\u6765\u6781\u5750\u6807\u67f1\u72b6\u56fe\uff0c\u4e00\u8d77\u6765\u5b66\u4e60\u4e0b\u5427~ \u67f1\u72b6\u56fe\u662f\u4e00\u79cd\u4ee5\u957f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":171579,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[182397],"tags":[],"class_list":["post-171578","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/171578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=171578"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/171578\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media\/171579"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=171578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=171578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=171578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}