{"id":95151,"date":"2026-08-16T10:49:23","date_gmt":"2026-08-16T02:49:23","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/95151.html"},"modified":"2026-08-16T10:49:23","modified_gmt":"2026-08-16T02:49:23","slug":"%e6%97%8b%e8%bd%ac%e7%9f%a9%e9%98%b5%ef%bc%9a%e4%ba%8c%e7%bb%b4%e7%82%b9%e7%bb%95%e5%8e%9f%e7%82%b9%e6%97%8b%e8%bd%ac","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/95151.html","title":{"rendered":"\u65cb\u8f6c\u77e9\u9635\uff1a\u4e8c\u7ef4\u70b9\u7ed5\u539f\u70b9\u65cb\u8f6c"},"content":{"rendered":"<h3>1. \u5f15\u8a00<\/h3>\n<p>\u5728\u8ba1\u7b97\u673a\u56fe\u5f62\u5b66\u3001\u7269\u7406\u6a21\u62df\u548c\u6570\u5b66\u53ef\u89c6\u5316\u4e2d&#xff0c;\u70b9\u7684\u65cb\u8f6c\u662f\u4e00\u4e2a\u57fa\u7840\u4e14\u91cd\u8981\u7684\u6982\u5ff5\u3002\u672c\u6587\u5c06\u4f7f\u7528 Python \u7684 Matplotlib \u5e93&#xff0c;\u901a\u8fc7\u52a8\u753b\u76f4\u89c2\u5730\u6f14\u793a\u4e00\u4e2a\u4e8c\u7ef4\u70b9\u5982\u4f55\u7ed5\u539f\u70b9\u8fdb\u884c\u65cb\u8f6c\u3002\u6211\u4eec\u5c06\u4ece\u65cb\u8f6c\u77e9\u9635\u7684\u6570\u5b66\u539f\u7406\u51fa\u53d1&#xff0c;\u9010\u6b65\u7f16\u5199\u4ee3\u7801&#xff0c;\u6700\u7ec8\u751f\u6210\u4e00\u4e2a\u5e73\u6ed1\u7684\u65cb\u8f6c\u52a8\u753b\u3002<\/p>\n<h3>2. \u65cb\u8f6c\u77e9\u9635\u539f\u7406<\/h3>\n<p>\u4e8c\u7ef4\u5e73\u9762\u4e2d&#xff0c;\u4e00\u4e2a\u70b9 (x, y) \u7ed5\u539f\u70b9\u9006\u65f6\u9488\u65cb\u8f6c \u03b8 \u5f27\u5ea6\u540e&#xff0c;\u65b0\u5750\u6807 (x&#039;, y&#039;) \u53ef\u4ee5\u901a\u8fc7\u65cb\u8f6c\u77e9\u9635\u8ba1\u7b97&#xff1a;<\/p>\n<p>[x&#039;]   [cos\u03b8  -sin\u03b8] [x]<br \/>\n[y&#039;] &#061; [sin\u03b8   cos\u03b8] [y]<\/p>\n<p>\u5c55\u5f00\u540e\u5f97\u5230&#xff1a;<\/p>\n<ul>\n<li>x&#039; &#061; x * cos\u03b8 &#8211; y * sin\u03b8<\/li>\n<li>y&#039; &#061; x * sin\u03b8 &#043; y * cos\u03b8<\/li>\n<\/ul>\n<p>\u8fd9\u5c31\u662f\u6211\u4eec\u4ee3\u7801\u4e2d rotate \u51fd\u6570\u7684\u6570\u5b66\u57fa\u7840\u3002<\/p>\n<h3>3. \u4ee3\u7801\u5b9e\u73b0<\/h3>\n<h4>3.1 \u5bfc\u5165\u5e93<\/h4>\n<p><span class=\"token keyword\">import<\/span> numpy <span class=\"token keyword\">as<\/span> np          <span class=\"token comment\"># \u5bfc\u5165 numpy&#xff0c;\u7528\u4e8e\u6570\u5b66\u8ba1\u7b97&#xff08;\u4e09\u89d2\u51fd\u6570\u3001\u6570\u7ec4&#xff09;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> matplotlib<span class=\"token punctuation\">.<\/span>pyplot <span class=\"token keyword\">as<\/span> plt  <span class=\"token comment\"># \u5bfc\u5165 matplotlib \u7ed8\u56fe\u5e93&#xff0c;\u7528\u4e8e\u7ed8\u5236\u56fe\u50cf<\/span><br \/>\n<span class=\"token keyword\">from<\/span> matplotlib<span class=\"token punctuation\">.<\/span>animation <span class=\"token keyword\">import<\/span> FuncAnimation  <span class=\"token comment\"># \u5bfc\u5165\u52a8\u753b\u6a21\u5757&#xff0c;\u7528\u4e8e\u751f\u6210\u9010\u5e27\u52a8\u753b<\/span><\/p>\n<h4>3.2 \u5b9a\u4e49\u65cb\u8f6c\u51fd\u6570<\/h4>\n<p><span class=\"token comment\"># \u65cb\u8f6c\u534a\u5f84<\/span><br \/>\nR <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">2.0<\/span>                      <span class=\"token comment\"># \u5b9a\u4e49\u521d\u59cb\u70b9\u8ddd\u79bb\u539f\u70b9\u7684\u8ddd\u79bb&#xff08;\u534a\u5f84&#xff09;<\/span><br \/>\n<span class=\"token comment\"># \u521d\u59cb\u70b9 (R, 0)<\/span><\/p>\n<p><span class=\"token triple-quoted-string string\">&#039;&#039;&#039;[x_f; y_f] &#061; [[cos(\u03b8), -sin(\u03b8)], [sin(\u03b8), cos(\u03b8)]] * [x_m; y_m]&#039;&#039;&#039;<\/span><br \/>\n<span class=\"token comment\"># \u4e8c\u7ef4\u65cb\u8f6c\u77e9\u9635<\/span><br \/>\n<span class=\"token keyword\">def<\/span> <span class=\"token function\">rotate<\/span><span class=\"token punctuation\">(<\/span>px<span class=\"token punctuation\">,<\/span> py<span class=\"token punctuation\">,<\/span> theta<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u5c06\u70b9 (px, py) \u7ed5\u539f\u70b9\u65cb\u8f6c theta \u5f27\u5ea6&#xff0c;\u8fd4\u56de\u65cb\u8f6c\u540e\u7684\u65b0\u5750\u6807\u3002&#034;&#034;&#034;<\/span><br \/>\n    c <span class=\"token operator\">&#061;<\/span> np<span class=\"token punctuation\">.<\/span>cos<span class=\"token punctuation\">(<\/span>theta<span class=\"token punctuation\">)<\/span>        <span class=\"token comment\"># \u8ba1\u7b97\u65cb\u8f6c\u89d2\u5ea6\u7684\u4f59\u5f26\u503c<\/span><br \/>\n    s <span class=\"token operator\">&#061;<\/span> np<span class=\"token punctuation\">.<\/span>sin<span class=\"token punctuation\">(<\/span>theta<span class=\"token punctuation\">)<\/span>        <span class=\"token comment\"># \u8ba1\u7b97\u65cb\u8f6c\u89d2\u5ea6\u7684\u6b63\u5f26\u503c<\/span><br \/>\n    x <span class=\"token operator\">&#061;<\/span> px <span class=\"token operator\">*<\/span> c <span class=\"token operator\">&#8211;<\/span> py <span class=\"token operator\">*<\/span> s      <span class=\"token comment\"># \u65cb\u8f6c\u516c\u5f0f&#xff1a;\u65b0 x &#061; px*cos\u03b8 &#8211; py*sin\u03b8<\/span><br \/>\n    y <span class=\"token operator\">&#061;<\/span> px <span class=\"token operator\">*<\/span> s <span class=\"token operator\">&#043;<\/span> py <span class=\"token operator\">*<\/span> c      <span class=\"token comment\"># \u65cb\u8f6c\u516c\u5f0f&#xff1a;\u65b0 y &#061; px*sin\u03b8 &#043; py*cos\u03b8<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> x<span class=\"token punctuation\">,<\/span> y              <span class=\"token comment\"># \u8fd4\u56de\u65cb\u8f6c\u540e\u7684\u5750\u6807 (x, y)<\/span><\/p>\n<h4>3.3 \u521d\u59cb\u5316\u753b\u5e03<\/h4>\n<p><span class=\"token comment\"># \u521b\u5efa\u753b\u5e03<\/span><br \/>\nfig<span class=\"token punctuation\">,<\/span> ax <span class=\"token operator\">&#061;<\/span> plt<span class=\"token punctuation\">.<\/span>subplots<span class=\"token punctuation\">(<\/span>figsize<span class=\"token operator\">&#061;<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">6<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">6<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span>  <span class=\"token comment\"># \u521b\u5efa 6&#215;6 \u82f1\u5bf8\u7684\u753b\u5e03\u548c\u5750\u6807\u8f74\u5bf9\u8c61<\/span><br \/>\nax<span class=\"token punctuation\">.<\/span>set_xlim<span class=\"token punctuation\">(<\/span><span class=\"token operator\">&#8211;<\/span>R <span class=\"token operator\">&#8211;<\/span> <span class=\"token number\">0.4<\/span><span class=\"token punctuation\">,<\/span> R <span class=\"token operator\">&#043;<\/span> <span class=\"token number\">0.4<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># \u8bbe\u7f6e x \u8f74\u663e\u793a\u8303\u56f4&#xff0c;\u7559\u51fa 0.4 \u7684\u8fb9\u8ddd<\/span><br \/>\nax<span class=\"token punctuation\">.<\/span>set_ylim<span class=\"token punctuation\">(<\/span><span class=\"token operator\">&#8211;<\/span>R <span class=\"token operator\">&#8211;<\/span> <span class=\"token number\">0.4<\/span><span class=\"token punctuation\">,<\/span> R <span class=\"token operator\">&#043;<\/span> <span class=\"token number\">0.4<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># \u8bbe\u7f6e y \u8f74\u663e\u793a\u8303\u56f4&#xff0c;\u7559\u51fa 0.4 \u7684\u8fb9\u8ddd<\/span><br \/>\nax<span class=\"token punctuation\">.<\/span>set_aspect<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;equal&#034;<\/span><span class=\"token punctuation\">)<\/span>           <span class=\"token comment\"># \u8bbe\u7f6e x\u3001y \u8f74\u6bd4\u4f8b\u76f8\u7b49&#xff0c;\u4fdd\u8bc1\u5706\u5f62\u4e0d\u53d8\u5f62<\/span><br \/>\nax<span class=\"token punctuation\">.<\/span>grid<span class=\"token punctuation\">(<\/span><span class=\"token boolean\">True<\/span><span class=\"token punctuation\">,<\/span> alpha<span class=\"token operator\">&#061;<\/span><span class=\"token number\">0.3<\/span><span class=\"token punctuation\">)<\/span>         <span class=\"token comment\"># \u5f00\u542f\u7f51\u683c\u7ebf&#xff0c;\u900f\u660e\u5ea6\u8bbe\u4e3a 0.3<\/span><br \/>\nax<span class=\"token punctuation\">.<\/span>axhline<span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">,<\/span> c<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;black&#034;<\/span><span class=\"token punctuation\">,<\/span> lw<span class=\"token operator\">&#061;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># \u7ed8\u5236 x \u8f74&#xff08;y&#061;0 \u7684\u6c34\u5e73\u7ebf&#xff09;<\/span><br \/>\nax<span class=\"token punctuation\">.<\/span>axvline<span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">,<\/span> c<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;black&#034;<\/span><span class=\"token punctuation\">,<\/span> lw<span class=\"token operator\">&#061;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># \u7ed8\u5236 y \u8f74&#xff08;x&#061;0 \u7684\u5782\u76f4\u7ebf&#xff09;<\/span><br \/>\nax<span class=\"token punctuation\">.<\/span>set_title<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;2D Point Rotate Around Origin&#034;<\/span><span class=\"token punctuation\">)<\/span>  <span class=\"token comment\"># \u8bbe\u7f6e\u56fe\u50cf\u6807\u9898<\/span><\/p>\n<p><span class=\"token comment\"># \u7ed8\u56fe\u5bf9\u8c61<\/span><br \/>\npoint<span class=\"token punctuation\">,<\/span> <span class=\"token operator\">&#061;<\/span> ax<span class=\"token punctuation\">.<\/span>plot<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;ro&#034;<\/span><span class=\"token punctuation\">,<\/span> markersize<span class=\"token operator\">&#061;<\/span><span class=\"token number\">8<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># \u521b\u5efa\u7ea2\u70b9\u5bf9\u8c61&#xff0c;\u521d\u59cb\u4e3a\u7a7a&#xff0c;\u5c3a\u5bf8 8&#xff0c;\u4ee3\u8868\u65cb\u8f6c\u7684\u70b9<\/span><\/p>\n<h4>3.4 \u5b9a\u4e49\u52a8\u753b\u51fd\u6570<\/h4>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">init<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u521d\u59cb\u5316\u51fd\u6570&#xff1a;blit \u6a21\u5f0f\u4e0b\u5148\u7ed8\u5236\u4e00\u5e27\u7a7a\u767d\u753b\u9762\u3002&#034;&#034;&#034;<\/span><br \/>\n    point<span class=\"token punctuation\">.<\/span>set_data<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span>      <span class=\"token comment\"># \u7ea2\u70b9\u521d\u59cb\u4e3a\u7a7a<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">(<\/span>point<span class=\"token punctuation\">,<\/span><span class=\"token punctuation\">)<\/span>             <span class=\"token comment\"># \u5fc5\u987b\u8fd4\u56de\u53ef\u8fed\u4ee3\u7684 Artist \u5e8f\u5217&#xff08;\u5355\u5143\u7d20\u5143\u7ec4&#xff09;<\/span><\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">update<\/span><span class=\"token punctuation\">(<\/span>frame<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u52a8\u753b\u6bcf\u4e00\u5e27\u7684\u66f4\u65b0\u51fd\u6570&#xff0c;frame \u4e3a\u5f53\u524d\u5e27\u7f16\u53f7\u3002&#034;&#034;&#034;<\/span><br \/>\n    theta <span class=\"token operator\">&#061;<\/span> np<span class=\"token punctuation\">.<\/span>radians<span class=\"token punctuation\">(<\/span>frame<span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># \u5c06\u5e27\u7f16\u53f7&#xff08;\u89d2\u5ea6\u503c&#xff09;\u4ece\u5ea6\u8f6c\u6362\u4e3a\u5f27\u5ea6<\/span><br \/>\n    x<span class=\"token punctuation\">,<\/span> y <span class=\"token operator\">&#061;<\/span> rotate<span class=\"token punctuation\">(<\/span>R<span class=\"token punctuation\">,<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">,<\/span> theta<span class=\"token punctuation\">)<\/span>  <span class=\"token comment\"># \u8ba1\u7b97\u521d\u59cb\u70b9 (R, 0) \u65cb\u8f6c theta \u540e\u7684\u5750\u6807<\/span><br \/>\n    point<span class=\"token punctuation\">.<\/span>set_data<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">[<\/span>x<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">[<\/span>y<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span>    <span class=\"token comment\"># \u66f4\u65b0\u7ea2\u70b9\u7684\u4f4d\u7f6e<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">(<\/span>point<span class=\"token punctuation\">,<\/span><span class=\"token punctuation\">)<\/span>             <span class=\"token comment\"># \u5fc5\u987b\u8fd4\u56de\u53ef\u8fed\u4ee3\u7684 Artist \u5e8f\u5217&#xff08;\u5355\u5143\u7d20\u5143\u7ec4&#xff09;<\/span><\/p>\n<h4>3.5 \u521b\u5efa\u5e76\u8fd0\u884c\u52a8\u753b<\/h4>\n<p><span class=\"token comment\"># \u52a8\u753b<\/span><br \/>\nani <span class=\"token operator\">&#061;<\/span> FuncAnimation<span class=\"token punctuation\">(<\/span>            <span class=\"token comment\"># \u521b\u5efa\u52a8\u753b\u5bf9\u8c61<\/span><br \/>\n    fig<span class=\"token punctuation\">,<\/span> update<span class=\"token punctuation\">,<\/span> frames<span class=\"token operator\">&#061;<\/span>np<span class=\"token punctuation\">.<\/span>arange<span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">360<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span>  <span class=\"token comment\"># \u5e27\u4ece 0\u00b0 \u5230 360\u00b0&#xff0c;\u6bcf 2\u00b0 \u4e00\u5e27<\/span><br \/>\n    init_func<span class=\"token operator\">&#061;<\/span>init<span class=\"token punctuation\">,<\/span>             <span class=\"token comment\"># \u521d\u59cb\u5316\u51fd\u6570&#xff1a;blit \u6a21\u5f0f\u7528\u5b83\u7ed8\u5236\u521d\u59cb\u7a7a\u767d\u5e27<\/span><br \/>\n    interval<span class=\"token operator\">&#061;<\/span><span class=\"token number\">30<\/span><span class=\"token punctuation\">,<\/span> blit<span class=\"token operator\">&#061;<\/span><span class=\"token boolean\">True<\/span><span class=\"token punctuation\">,<\/span> repeat<span class=\"token operator\">&#061;<\/span><span class=\"token boolean\">True<\/span>        <span class=\"token comment\"># \u6bcf\u5e27\u95f4\u9694 30ms&#xff1b;blit&#061;True \u52a0\u5feb\u6e32\u67d3&#xff1b;\u5faa\u73af\u64ad\u653e<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><\/p>\n<p>plt<span class=\"token punctuation\">.<\/span>show<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span>                      <span class=\"token comment\"># \u663e\u793a\u52a8\u753b\u7a97\u53e3<\/span><\/p>\n<h3>4. \u4ee3\u7801\u89e3\u6790<\/h3>\n<li>\u65cb\u8f6c\u77e9\u9635&#xff1a;rotate \u51fd\u6570\u5b9e\u73b0\u4e86\u4e8c\u7ef4\u65cb\u8f6c\u77e9\u9635\u7684\u4e58\u6cd5\u8fd0\u7b97\u3002<\/li>\n<li>\u52a8\u753b\u53c2\u6570&#xff1a;\n<ul>\n<li>frames&#061;np.arange(0, 360, 2)&#xff1a;\u751f\u6210\u4ece 0\u00b0 \u5230 360\u00b0&#xff0c;\u6b65\u957f\u4e3a 2\u00b0 \u7684\u5e27\u5e8f\u5217&#xff0c;\u5171 180 \u5e27\u3002<\/li>\n<li>interval&#061;30&#xff1a;\u6bcf\u5e27\u95f4\u9694 30 \u6beb\u79d2&#xff0c;\u52a8\u753b\u901f\u5ea6\u7ea6\u4e3a 33 \u5e27\/\u79d2\u3002<\/li>\n<li>blit&#061;True&#xff1a;\u53ea\u91cd\u7ed8\u53d8\u5316\u7684\u90e8\u5206&#xff08;\u7ea2\u70b9&#xff09;&#xff0c;\u5927\u5e45\u63d0\u5347\u6e32\u67d3\u6548\u7387\u3002<\/li>\n<li>repeat&#061;True&#xff1a;\u52a8\u753b\u64ad\u653e\u5b8c\u6bd5\u540e\u81ea\u52a8\u5faa\u73af\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u5750\u6807\u8f74\u8bbe\u7f6e&#xff1a;ax.set_aspect(&#034;equal&#034;) \u786e\u4fdd x \u548c y \u8f74\u6bd4\u4f8b\u4e00\u81f4&#xff0c;\u65cb\u8f6c\u8f68\u8ff9\u5448\u73b0\u5b8c\u7f8e\u7684\u5706\u5f62\u3002<\/li>\n<h3>5. \u8fd0\u884c\u6548\u679c<\/h3>\n<p>\u8fd0\u884c\u4e0a\u8ff0\u4ee3\u7801\u540e&#xff0c;\u4f1a\u5f39\u51fa\u4e00\u4e2a\u7a97\u53e3&#xff0c;\u663e\u793a\u4e00\u4e2a\u7ea2\u70b9\u4ee5\u539f\u70b9\u4e3a\u4e2d\u5fc3\u3001\u534a\u5f84\u4e3a 2 \u7684\u5706\u5f62\u8f68\u8ff9\u5300\u901f\u65cb\u8f6c\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539 R \u7684\u503c\u6765\u6539\u53d8\u65cb\u8f6c\u534a\u5f84&#xff0c;\u6216\u8c03\u6574 frames \u548c interval \u53c2\u6570\u6765\u6539\u53d8\u65cb\u8f6c\u901f\u5ea6\u548c\u6d41\u7545\u5ea6\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/08\/20260816024922-6a8125322740c.gif\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h3>6. \u6269\u5c55\u601d\u8003<\/h3>\n<ul>\n<li>\u7ed5\u4efb\u610f\u70b9\u65cb\u8f6c&#xff1a;\u4fee\u6539 rotate \u51fd\u6570&#xff0c;\u5148\u5e73\u79fb\u5750\u6807\u7cfb\u4f7f\u65cb\u8f6c\u4e2d\u5fc3\u79fb\u81f3\u539f\u70b9&#xff0c;\u65cb\u8f6c\u540e\u518d\u5e73\u79fb\u56de\u53bb\u3002<\/li>\n<li>\u7ed8\u5236\u8f68\u8ff9&#xff1a;\u5728 update \u51fd\u6570\u4e2d\u8bb0\u5f55\u5386\u53f2\u4f4d\u7f6e\u5e76\u7ed8\u5236\u8fde\u7ebf&#xff0c;\u53ef\u76f4\u89c2\u770b\u5230\u5706\u5f62\u8def\u5f84\u3002<\/li>\n<li>\u4e09\u7ef4\u65cb\u8f6c&#xff1a;\u4f7f\u7528\u7c7b\u4f3c\u539f\u7406&#xff0c;\u53ef\u4ee5\u6269\u5c55\u5230\u4e09\u7ef4\u7a7a\u95f4\u7ed5\u8f74\u65cb\u8f6c\u3002<\/li>\n<\/ul>\n<h3>7. \u603b\u7ed3<\/h3>\n<p>\u672c\u6587\u901a\u8fc7\u4e00\u4e2a\u7b80\u6d01\u7684 Python \u52a8\u753b\u793a\u4f8b&#xff0c;\u6f14\u793a\u4e86\u4e8c\u7ef4\u65cb\u8f6c\u77e9\u9635\u7684\u5e94\u7528\u3002\u4ee3\u7801\u7ed3\u6784\u6e05\u6670&#xff0c;\u6ce8\u91ca\u8be6\u7ec6&#xff0c;\u9002\u5408\u521d\u5b66\u8005\u7406\u89e3\u65cb\u8f6c\u7684\u6570\u5b66\u539f\u7406\u548c Matplotlib \u52a8\u753b\u7684\u57fa\u672c\u7528\u6cd5\u3002\u4f60\u53ef\u4ee5\u5728\u6b64\u57fa\u7840\u4e0a\u8fdb\u884c\u4fee\u6539\u548c\u6269\u5c55&#xff0c;\u5b9e\u73b0\u66f4\u590d\u6742\u7684\u56fe\u5f62\u52a8\u753b\u6548\u679c\u3002<\/p>\n<h3>\u9644<\/h3>\n<p><span class=\"token keyword\">import<\/span> numpy <span class=\"token keyword\">as<\/span> np          <span class=\"token comment\"># \u5bfc\u5165 numpy&#xff0c;\u7528\u4e8e\u6570\u5b66\u8ba1\u7b97&#xff08;\u4e09\u89d2\u51fd\u6570\u3001\u6570\u7ec4&#xff09;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> matplotlib<span class=\"token punctuation\">.<\/span>pyplot <span class=\"token keyword\">as<\/span> plt  <span class=\"token comment\"># \u5bfc\u5165 matplotlib \u7ed8\u56fe\u5e93&#xff0c;\u7528\u4e8e\u7ed8\u5236\u56fe\u50cf<\/span><br \/>\n<span class=\"token keyword\">from<\/span> matplotlib<span class=\"token punctuation\">.<\/span>animation <span class=\"token keyword\">import<\/span> FuncAnimation  <span class=\"token comment\"># \u5bfc\u5165\u52a8\u753b\u6a21\u5757&#xff0c;\u7528\u4e8e\u751f\u6210\u9010\u5e27\u52a8\u753b<\/span><\/p>\n<p><span class=\"token comment\"># \u65cb\u8f6c\u534a\u5f84<\/span><br \/>\nR <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">2.0<\/span>                      <span class=\"token comment\"># \u5b9a\u4e49\u521d\u59cb\u70b9\u8ddd\u79bb\u539f\u70b9\u7684\u8ddd\u79bb&#xff08;\u534a\u5f84&#xff09;<\/span><br \/>\n<span class=\"token comment\"># \u521d\u59cb\u70b9 (R, 0)<\/span><\/p>\n<p><span class=\"token triple-quoted-string string\">&#039;&#039;&#039;[x_f; y_f] &#061; [[cos(\u03b8), -sin(\u03b8)], [sin(\u03b8), cos(\u03b8)]] * [x_m; y_m]&#039;&#039;&#039;<\/span><br \/>\n<span class=\"token comment\"># \u4e8c\u7ef4\u65cb\u8f6c\u77e9\u9635<\/span><br \/>\n<span class=\"token keyword\">def<\/span> <span class=\"token function\">rotate<\/span><span class=\"token punctuation\">(<\/span>px<span class=\"token punctuation\">,<\/span> py<span class=\"token punctuation\">,<\/span> theta<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u5c06\u70b9 (px, py) \u7ed5\u539f\u70b9\u65cb\u8f6c theta \u5f27\u5ea6&#xff0c;\u8fd4\u56de\u65cb\u8f6c\u540e\u7684\u65b0\u5750\u6807\u3002&#034;&#034;&#034;<\/span><br \/>\n    c <span class=\"token operator\">&#061;<\/span> np<span class=\"token punctuation\">.<\/span>cos<span class=\"token punctuation\">(<\/span>theta<span class=\"token punctuation\">)<\/span>        <span class=\"token comment\"># \u8ba1\u7b97\u65cb\u8f6c\u89d2\u5ea6\u7684\u4f59\u5f26\u503c<\/span><br \/>\n    s <span class=\"token operator\">&#061;<\/span> np<span class=\"token punctuation\">.<\/span>sin<span class=\"token punctuation\">(<\/span>theta<span class=\"token punctuation\">)<\/span>        <span class=\"token comment\"># \u8ba1\u7b97\u65cb\u8f6c\u89d2\u5ea6\u7684\u6b63\u5f26\u503c<\/span><br \/>\n    x <span class=\"token operator\">&#061;<\/span> px <span class=\"token operator\">*<\/span> c <span class=\"token operator\">&#8211;<\/span> py <span class=\"token operator\">*<\/span> s      <span class=\"token comment\"># \u65cb\u8f6c\u516c\u5f0f&#xff1a;\u65b0 x &#061; px*cos\u03b8 &#8211; py*sin\u03b8<\/span><br \/>\n    y <span class=\"token operator\">&#061;<\/span> px <span class=\"token operator\">*<\/span> s <span class=\"token operator\">&#043;<\/span> py <span class=\"token operator\">*<\/span> c      <span class=\"token comment\"># \u65cb\u8f6c\u516c\u5f0f&#xff1a;\u65b0 y &#061; px*sin\u03b8 &#043; py*cos\u03b8<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> x<span class=\"token punctuation\">,<\/span> y              <span class=\"token comment\"># \u8fd4\u56de\u65cb\u8f6c\u540e\u7684\u5750\u6807 (x, y)<\/span><\/p>\n<p><span class=\"token comment\"># \u521b\u5efa\u753b\u5e03<\/span><br \/>\nfig<span class=\"token punctuation\">,<\/span> ax <span class=\"token operator\">&#061;<\/span> plt<span class=\"token punctuation\">.<\/span>subplots<span class=\"token punctuation\">(<\/span>figsize<span class=\"token operator\">&#061;<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">6<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">6<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span>  <span class=\"token comment\"># \u521b\u5efa 6&#215;6 \u82f1\u5bf8\u7684\u753b\u5e03\u548c\u5750\u6807\u8f74\u5bf9\u8c61<\/span><br \/>\nax<span class=\"token punctuation\">.<\/span>set_xlim<span class=\"token punctuation\">(<\/span><span class=\"token operator\">&#8211;<\/span>R <span class=\"token operator\">&#8211;<\/span> <span class=\"token number\">0.4<\/span><span class=\"token punctuation\">,<\/span> R <span class=\"token operator\">&#043;<\/span> <span class=\"token number\">0.4<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># \u8bbe\u7f6e x \u8f74\u663e\u793a\u8303\u56f4&#xff0c;\u7559\u51fa 0.4 \u7684\u8fb9\u8ddd<\/span><br \/>\nax<span class=\"token punctuation\">.<\/span>set_ylim<span class=\"token punctuation\">(<\/span><span class=\"token operator\">&#8211;<\/span>R <span class=\"token operator\">&#8211;<\/span> <span class=\"token number\">0.4<\/span><span class=\"token punctuation\">,<\/span> R <span class=\"token operator\">&#043;<\/span> <span class=\"token number\">0.4<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># \u8bbe\u7f6e y \u8f74\u663e\u793a\u8303\u56f4&#xff0c;\u7559\u51fa 0.4 \u7684\u8fb9\u8ddd<\/span><br \/>\nax<span class=\"token punctuation\">.<\/span>set_aspect<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;equal&#034;<\/span><span class=\"token punctuation\">)<\/span>           <span class=\"token comment\"># \u8bbe\u7f6e x\u3001y \u8f74\u6bd4\u4f8b\u76f8\u7b49&#xff0c;\u4fdd\u8bc1\u5706\u5f62\u4e0d\u53d8\u5f62<\/span><br \/>\nax<span class=\"token punctuation\">.<\/span>grid<span class=\"token punctuation\">(<\/span><span class=\"token boolean\">True<\/span><span class=\"token punctuation\">,<\/span> alpha<span class=\"token operator\">&#061;<\/span><span class=\"token number\">0.3<\/span><span class=\"token punctuation\">)<\/span>         <span class=\"token comment\"># \u5f00\u542f\u7f51\u683c\u7ebf&#xff0c;\u900f\u660e\u5ea6\u8bbe\u4e3a 0.3<\/span><br \/>\nax<span class=\"token punctuation\">.<\/span>axhline<span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">,<\/span> c<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;black&#034;<\/span><span class=\"token punctuation\">,<\/span> lw<span class=\"token operator\">&#061;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># \u7ed8\u5236 x \u8f74&#xff08;y&#061;0 \u7684\u6c34\u5e73\u7ebf&#xff09;<\/span><br \/>\nax<span class=\"token punctuation\">.<\/span>axvline<span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">,<\/span> c<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;black&#034;<\/span><span class=\"token punctuation\">,<\/span> lw<span class=\"token operator\">&#061;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># \u7ed8\u5236 y \u8f74&#xff08;x&#061;0 \u7684\u5782\u76f4\u7ebf&#xff09;<\/span><br \/>\nax<span class=\"token punctuation\">.<\/span>set_title<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;2D Point Rotate Around Origin&#034;<\/span><span class=\"token punctuation\">)<\/span>  <span class=\"token comment\"># \u8bbe\u7f6e\u56fe\u50cf\u6807\u9898<\/span><\/p>\n<p><span class=\"token comment\"># \u7ed8\u56fe\u5bf9\u8c61<\/span><br \/>\npoint<span class=\"token punctuation\">,<\/span> <span class=\"token operator\">&#061;<\/span> ax<span class=\"token punctuation\">.<\/span>plot<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;ro&#034;<\/span><span class=\"token punctuation\">,<\/span> markersize<span class=\"token operator\">&#061;<\/span><span class=\"token number\">8<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># \u521b\u5efa\u7ea2\u70b9\u5bf9\u8c61&#xff0c;\u521d\u59cb\u4e3a\u7a7a&#xff0c;\u5c3a\u5bf8 8&#xff0c;\u4ee3\u8868\u65cb\u8f6c\u7684\u70b9<\/span><\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">init<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u521d\u59cb\u5316\u51fd\u6570&#xff1a;blit \u6a21\u5f0f\u4e0b\u5148\u7ed8\u5236\u4e00\u5e27\u7a7a\u767d\u753b\u9762\u3002&#034;&#034;&#034;<\/span><br \/>\n    point<span class=\"token punctuation\">.<\/span>set_data<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span>      <span class=\"token comment\"># \u7ea2\u70b9\u521d\u59cb\u4e3a\u7a7a<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">(<\/span>point<span class=\"token punctuation\">,<\/span><span class=\"token punctuation\">)<\/span>             <span class=\"token comment\"># \u5fc5\u987b\u8fd4\u56de\u53ef\u8fed\u4ee3\u7684 Artist \u5e8f\u5217&#xff08;\u5355\u5143\u7d20\u5143\u7ec4&#xff09;<\/span><\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">update<\/span><span class=\"token punctuation\">(<\/span>frame<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u52a8\u753b\u6bcf\u4e00\u5e27\u7684\u66f4\u65b0\u51fd\u6570&#xff0c;frame \u4e3a\u5f53\u524d\u5e27\u7f16\u53f7\u3002&#034;&#034;&#034;<\/span><br \/>\n    theta <span class=\"token operator\">&#061;<\/span> np<span class=\"token punctuation\">.<\/span>radians<span class=\"token punctuation\">(<\/span>frame<span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># \u5c06\u5e27\u7f16\u53f7&#xff08;\u89d2\u5ea6\u503c&#xff09;\u4ece\u5ea6\u8f6c\u6362\u4e3a\u5f27\u5ea6<\/span><br \/>\n    x<span class=\"token punctuation\">,<\/span> y <span class=\"token operator\">&#061;<\/span> rotate<span class=\"token punctuation\">(<\/span>R<span class=\"token punctuation\">,<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">,<\/span> theta<span class=\"token punctuation\">)<\/span>  <span class=\"token comment\"># \u8ba1\u7b97\u521d\u59cb\u70b9 (R, 0) \u65cb\u8f6c theta \u540e\u7684\u5750\u6807<\/span><br \/>\n    point<span class=\"token punctuation\">.<\/span>set_data<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">[<\/span>x<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">[<\/span>y<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span>    <span class=\"token comment\"># \u66f4\u65b0\u7ea2\u70b9\u7684\u4f4d\u7f6e<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">(<\/span>point<span class=\"token punctuation\">,<\/span><span class=\"token punctuation\">)<\/span>             <span class=\"token comment\"># \u5fc5\u987b\u8fd4\u56de\u53ef\u8fed\u4ee3\u7684 Artist \u5e8f\u5217&#xff08;\u5355\u5143\u7d20\u5143\u7ec4&#xff09;<\/span><\/p>\n<p><span class=\"token comment\"># ani &#061; FuncAnimation(<\/span><br \/>\n<span class=\"token comment\">#     fig,                    # \u2460 \u753b\u5e03\u5bf9\u8c61&#xff1a;\u544a\u8bc9\u52a8\u753b&#034;\u5728\u54ea\u5757\u753b\u5e03\u4e0a\u64ad\u653e&#034;<\/span><br \/>\n<span class=\"token comment\">#     update,                 # \u2461 \u66f4\u65b0\u51fd\u6570&#xff1a;\u544a\u8bc9\u52a8\u753b&#034;\u6bcf\u5e27\u8c03\u7528\u54ea\u4e2a\u51fd\u6570\u6765\u753b\u56fe&#034;<\/span><br \/>\n<span class=\"token comment\">#     frames&#061;np.arange(0, 360, 2),   # \u2462 \u5e27\u5e8f\u5217&#xff1a;\u544a\u8bc9\u52a8\u753b&#034;\u4e00\u5171\u6709\u591a\u5c11\u5e27&#034;<\/span><br \/>\n<span class=\"token comment\">#     interval&#061;30,            # \u2463 \u65f6\u95f4\u95f4\u9694&#xff1a;\u6bcf\u5e27\u4e4b\u95f4\u9694\u591a\u5c11\u6beb\u79d2&#xff08;30ms&#xff09;<\/span><br \/>\n<span class=\"token comment\">#     blit&#061;True,              # \u2464 \u662f\u5426\u53ea\u91cd\u7ed8\u53d8\u5316\u7684\u90e8\u5206<\/span><br \/>\n<span class=\"token comment\">#     repeat&#061;True             # \u2465 \u64ad\u5b8c\u4e00\u904d\u540e\u662f\u5426\u5faa\u73af<\/span><br \/>\n<span class=\"token comment\"># )<\/span><\/p>\n<p><span class=\"token comment\"># \u52a8\u753b<\/span><br \/>\nani <span class=\"token operator\">&#061;<\/span> FuncAnimation<span class=\"token punctuation\">(<\/span>            <span class=\"token comment\"># \u521b\u5efa\u52a8\u753b\u5bf9\u8c61<\/span><br \/>\n    fig<span class=\"token punctuation\">,<\/span> update<span class=\"token punctuation\">,<\/span> frames<span class=\"token operator\">&#061;<\/span>np<span class=\"token punctuation\">.<\/span>arange<span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">360<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span>  <span class=\"token comment\"># \u5e27\u4ece 0\u00b0 \u5230 360\u00b0&#xff0c;\u6bcf 2\u00b0 \u4e00\u5e27<\/span><br \/>\n    init_func<span class=\"token operator\">&#061;<\/span>init<span class=\"token punctuation\">,<\/span>             <span class=\"token comment\"># \u521d\u59cb\u5316\u51fd\u6570&#xff1a;blit \u6a21\u5f0f\u7528\u5b83\u7ed8\u5236\u521d\u59cb\u7a7a\u767d\u5e27<\/span><br \/>\n    interval<span class=\"token operator\">&#061;<\/span><span class=\"token number\">30<\/span><span class=\"token punctuation\">,<\/span> blit<span class=\"token operator\">&#061;<\/span><span class=\"token boolean\">True<\/span><span class=\"token punctuation\">,<\/span> repeat<span class=\"token operator\">&#061;<\/span><span class=\"token boolean\">True<\/span>        <span class=\"token comment\"># \u6bcf\u5e27\u95f4\u9694 30ms&#xff1b;blit&#061;True \u52a0\u5feb\u6e32\u67d3&#xff1b;\u5faa\u73af\u64ad\u653e<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><\/p>\n<p>plt<span class=\"token punctuation\">.<\/span>show<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span>                      <span class=\"token comment\"># \u663e\u793a\u52a8\u753b\u7a97\u53e3<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u5f15\u8a00<br \/>\n\u5728\u8ba1\u7b97\u673a\u56fe\u5f62\u5b66\u3001\u7269\u7406\u6a21\u62df\u548c\u6570\u5b66\u53ef\u89c6\u5316\u4e2d&#xff0c;\u70b9\u7684\u65cb\u8f6c\u662f\u4e00\u4e2a\u57fa\u7840\u4e14\u91cd\u8981\u7684\u6982\u5ff5\u3002\u672c\u6587\u5c06\u4f7f\u7528 Python \u7684 Matplotlib \u5e93&#xff0c;\u901a\u8fc7\u52a8\u753b\u76f4\u89c2\u5730\u6f14\u793a\u4e00\u4e2a\u4e8c\u7ef4\u70b9\u5982\u4f55\u7ed5\u539f\u70b9\u8fdb\u884c\u65cb\u8f6c\u3002\u6211\u4eec\u5c06\u4ece\u65cb\u8f6c\u77e9\u9635\u7684\u6570\u5b66\u539f\u7406\u51fa\u53d1&#xff0c;\u9010\u6b65\u7f16\u5199\u4ee3\u7801&#xff0c;\u6700\u7ec8\u751f\u6210\u4e00\u4e2a\u5e73\u6ed1\u7684\u65cb\u8f6c\u52a8\u753b\u3002<br \/>\n2. \u65cb\u8f6c\u77e9\u9635\u539f\u7406<br \/>\n\u4e8c\u7ef4\u5e73\u9762\u4e2d&#xff0c;\u4e00\u4e2a\u70b9 (x, y) \u7ed5\u539f\u70b9\u9006\u65f6\u9488\u65cb\u8f6c \u03b8 \u5f27\u5ea6\u540e&#xff0c;\u65b0\u5750\u6807 (x, y) \u53ef\u4ee5\u901a\u8fc7\u65cb\u8f6c\u77e9\u9635\u8ba1\u7b97&amp;#x<\/p>\n","protected":false},"author":2,"featured_media":95150,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[81,1578,1649],"topic":[],"class_list":["post-95151","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-python","tag-1578","tag-1649"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u65cb\u8f6c\u77e9\u9635\uff1a\u4e8c\u7ef4\u70b9\u7ed5\u539f\u70b9\u65cb\u8f6c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/95151.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u65cb\u8f6c\u77e9\u9635\uff1a\u4e8c\u7ef4\u70b9\u7ed5\u539f\u70b9\u65cb\u8f6c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"1. \u5f15\u8a00 \u5728\u8ba1\u7b97\u673a\u56fe\u5f62\u5b66\u3001\u7269\u7406\u6a21\u62df\u548c\u6570\u5b66\u53ef\u89c6\u5316\u4e2d&#xff0c;\u70b9\u7684\u65cb\u8f6c\u662f\u4e00\u4e2a\u57fa\u7840\u4e14\u91cd\u8981\u7684\u6982\u5ff5\u3002\u672c\u6587\u5c06\u4f7f\u7528 Python \u7684 Matplotlib \u5e93&#xff0c;\u901a\u8fc7\u52a8\u753b\u76f4\u89c2\u5730\u6f14\u793a\u4e00\u4e2a\u4e8c\u7ef4\u70b9\u5982\u4f55\u7ed5\u539f\u70b9\u8fdb\u884c\u65cb\u8f6c\u3002\u6211\u4eec\u5c06\u4ece\u65cb\u8f6c\u77e9\u9635\u7684\u6570\u5b66\u539f\u7406\u51fa\u53d1&#xff0c;\u9010\u6b65\u7f16\u5199\u4ee3\u7801&#xff0c;\u6700\u7ec8\u751f\u6210\u4e00\u4e2a\u5e73\u6ed1\u7684\u65cb\u8f6c\u52a8\u753b\u3002 2. \u65cb\u8f6c\u77e9\u9635\u539f\u7406 \u4e8c\u7ef4\u5e73\u9762\u4e2d&#xff0c;\u4e00\u4e2a\u70b9 (x, y) \u7ed5\u539f\u70b9\u9006\u65f6\u9488\u65cb\u8f6c \u03b8 \u5f27\u5ea6\u540e&#xff0c;\u65b0\u5750\u6807 (x, y) \u53ef\u4ee5\u901a\u8fc7\u65cb\u8f6c\u77e9\u9635\u8ba1\u7b97&amp;#x\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/95151.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-16T02:49:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/08\/20260816024922-6a8125322740c.gif\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/95151.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/95151.html\",\"name\":\"\u65cb\u8f6c\u77e9\u9635\uff1a\u4e8c\u7ef4\u70b9\u7ed5\u539f\u70b9\u65cb\u8f6c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-16T02:49:23+00:00\",\"dateModified\":\"2026-08-16T02:49:23+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/95151.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/95151.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/95151.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u65cb\u8f6c\u77e9\u9635\uff1a\u4e8c\u7ef4\u70b9\u7ed5\u539f\u70b9\u65cb\u8f6c\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u65cb\u8f6c\u77e9\u9635\uff1a\u4e8c\u7ef4\u70b9\u7ed5\u539f\u70b9\u65cb\u8f6c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/95151.html","og_locale":"zh_CN","og_type":"article","og_title":"\u65cb\u8f6c\u77e9\u9635\uff1a\u4e8c\u7ef4\u70b9\u7ed5\u539f\u70b9\u65cb\u8f6c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"1. \u5f15\u8a00 \u5728\u8ba1\u7b97\u673a\u56fe\u5f62\u5b66\u3001\u7269\u7406\u6a21\u62df\u548c\u6570\u5b66\u53ef\u89c6\u5316\u4e2d&#xff0c;\u70b9\u7684\u65cb\u8f6c\u662f\u4e00\u4e2a\u57fa\u7840\u4e14\u91cd\u8981\u7684\u6982\u5ff5\u3002\u672c\u6587\u5c06\u4f7f\u7528 Python \u7684 Matplotlib \u5e93&#xff0c;\u901a\u8fc7\u52a8\u753b\u76f4\u89c2\u5730\u6f14\u793a\u4e00\u4e2a\u4e8c\u7ef4\u70b9\u5982\u4f55\u7ed5\u539f\u70b9\u8fdb\u884c\u65cb\u8f6c\u3002\u6211\u4eec\u5c06\u4ece\u65cb\u8f6c\u77e9\u9635\u7684\u6570\u5b66\u539f\u7406\u51fa\u53d1&#xff0c;\u9010\u6b65\u7f16\u5199\u4ee3\u7801&#xff0c;\u6700\u7ec8\u751f\u6210\u4e00\u4e2a\u5e73\u6ed1\u7684\u65cb\u8f6c\u52a8\u753b\u3002 2. \u65cb\u8f6c\u77e9\u9635\u539f\u7406 \u4e8c\u7ef4\u5e73\u9762\u4e2d&#xff0c;\u4e00\u4e2a\u70b9 (x, y) \u7ed5\u539f\u70b9\u9006\u65f6\u9488\u65cb\u8f6c \u03b8 \u5f27\u5ea6\u540e&#xff0c;\u65b0\u5750\u6807 (x, y) \u53ef\u4ee5\u901a\u8fc7\u65cb\u8f6c\u77e9\u9635\u8ba1\u7b97&amp;#x","og_url":"https:\/\/www.wsisp.com\/helps\/95151.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-16T02:49:23+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/08\/20260816024922-6a8125322740c.gif"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/95151.html","url":"https:\/\/www.wsisp.com\/helps\/95151.html","name":"\u65cb\u8f6c\u77e9\u9635\uff1a\u4e8c\u7ef4\u70b9\u7ed5\u539f\u70b9\u65cb\u8f6c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-16T02:49:23+00:00","dateModified":"2026-08-16T02:49:23+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/95151.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/95151.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/95151.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u65cb\u8f6c\u77e9\u9635\uff1a\u4e8c\u7ef4\u70b9\u7ed5\u539f\u70b9\u65cb\u8f6c"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/95151","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=95151"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/95151\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/95150"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=95151"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=95151"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=95151"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=95151"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}