{"id":3670,"date":"2022-03-18T12:09:02","date_gmt":"2022-03-18T04:09:02","guid":{"rendered":"https:\/\/egonlin.com\/?p=3670"},"modified":"2022-03-18T12:09:02","modified_gmt":"2022-03-18T04:09:02","slug":"%e7%ac%ac%e4%b8%80%e8%8a%82%ef%bc%9a%e6%95%b0%e6%8d%ae%e5%8f%af%e8%a7%86%e5%8c%96","status":"publish","type":"post","link":"https:\/\/egonlin.com\/?p=3670","title":{"rendered":"\u7b2c\u4e00\u8282\uff1a\u6570\u636e\u53ef\u89c6\u5316"},"content":{"rendered":"<ul>\n<li>\u4ec0\u4e48\u662f\u6570\u636e\u53ef\u89c6\u5316<\/li>\n<li>Matplotlib\u7684\u7528\u6cd5<\/li>\n<li>\u91d1\u878d\u5b66\u56fe\u8868<\/li>\n<li>\u4fdd\u5b58\u56fe\u8868<\/li>\n<\/ul>\n<h1>1\u3001\u4ec0\u4e48\u662f\u6570\u636e\u53ef\u89c6\u5316<\/h1>\n<p>\u200b   \u6570\u636e\u53ef\u89c6\u5316\u5728\u91cf\u5316\u5206\u6790\u5f53\u4e2d\u662f\u4e00\u4e2a\u975e\u5e38\u5173\u952e\u7684\u8f85\u52a9\u5de5\u5177\uff0c\u5f80\u5f80\u6211\u4eec\u9700\u8981\u901a\u8fc7\u53ef\u89c6\u5316\u6280\u672f\uff0c\u5bf9\u6211\u4eec\u7684\u6570\u636e\u8fdb\u884c\u66f4\u6e05\u6670\u7684\u5c55\u793a\uff0c\u8fd9\u6837\u4e5f\u80fd\u5e2e\u52a9\u6211\u4eec\u7406\u89e3\u4ea4\u6613\u3001\u7406\u89e3\u6570\u636e\u3002\u901a\u8fc7\u6570\u636e\u7684\u53ef\u89c6\u5316\u4e5f\u53ef\u4ee5\u66f4\u5feb\u901f\u7684\u53d1\u73b0\u91cf\u5316\u6295\u8d44\u4e2d\u7684\u4e00\u4e9b\u95ee\u9898\uff0c\u66f4\u6709\u5229\u4e8e\u5206\u6790\u5e76\u89e3\u51b3\u5b83\u4eec\u3002\u63a5\u4e0b\u6765\u6211\u4eec\u4e3b\u8981\u4f7f\u7528\u7684\u53ef\u89c6\u5316\u5de5\u5177\u5305\u53eb\u505a\u2014\u2014<em><code>Matplotlib<\/code><\/em>\uff0c\u5b83\u662f\u57fa\u4e8eNumpy\u548ctkinter\u4e8c\u6b21\u5f00\u53d1\u7684\uff0c\u5b83\u662f\u4e00\u4e2a\u5f3a\u5927\u7684Python\u7ed8\u56fe\u548c\u6570\u636e\u53ef\u89c6\u5316\u7684\u5de5\u5177\u5305\u3002<\/p>\n<h1>2\u3001Matplotlib\u7684\u7528\u6cd5<\/h1>\n<h2>2.1\u3001Matplotlib\u7ed8\u56fe\u57fa\u7840<\/h2>\n<p>\u5b89\u88c5\u65b9\u5f0f\uff1a<\/p>\n<blockquote>\n<p>pip install matplotlib<\/p>\n<\/blockquote>\n<p>\u5f15\u7528\u65b9\u6cd5\uff1a<\/p>\n<blockquote>\n<p>import matplotlib.pyplot as plt<\/p>\n<\/blockquote>\n<p>\u200b   matplotlib\u662fpython\u4e2d\u76842D\u7ed8\u56fe\u5e93\uff0c\u4e5f\u662f\u76ee\u524d\u4f7f\u7528\u6700\u5e7f\u6cdb\u7684python\u7ed8\u56fe\u5e93\u3002\u867d\u7136\u5b83\u5f88\u5e9e\u5927\uff0c\u4f46\u662f\u53ef\u4ee5\u901a\u8fc7\u7b80\u5355\u7684\u6982\u5ff5\u6846\u67b6\u548c\u91cd\u8981\u7684\u77e5\u8bc6\u6765\u7406\u89e3\u638c\u63e1\u3002\u5b83\u7684\u56fe\u50cf\u5927\u6982\u53ef\u4ee5\u5206\u4e3a\u4ee5\u4e0b4\u5c42\u7ed3\u6784\u3002<\/p>\n<p>1\uff09canvas\uff08\u753b\u677f\uff09\uff1a\u4f4d\u4e8e\u6700\u5e95\u5c42\uff0c\u5bfc\u5165matplotlib\u5e93\u65f6\u5c31\u81ea\u52a8\u5b58\u5728\u3002<\/p>\n<p>2\uff09figure\uff08\u753b\u5e03\uff09\uff1a\u5efa\u7acb\u5728canvas\u4e4b\u4e0a\uff0c\u4ece\u8fd9\u4e00\u5c42\u5c31\u53ef\u4ee5\u5f00\u59cb\u8bbe\u7f6e\u53c2\u6570<\/p>\n<p>3\uff09axes\uff08\u5b50\u56fe\uff09\uff1a\u5c06figure\u5206\u6210\u4e0d\u540c\u7684\u5757\uff0c\u5b9e\u73b0\u5206\u9762\u7ed8\u56fe<\/p>\n<p>4\uff09\u56fe\u8868\u4fe1\u606f\uff08\u6784\u56fe\u5143\u7d20\uff09\uff1a\u6dfb\u4ef6\u6216\u4fee\u6539axes\u4e0a\u7684\u56fe\u5f62\u4fe1\u606f\uff0c\u4f18\u5316\u56fe\u8868\u7684\u663e\u793a\u6548\u679c<\/p>\n<h2>2.2\u3001\u7ed8\u56fe\u57fa\u672c\u6d41\u7a0b<\/h2>\n<p>\u6839\u636e\u4ee5\u4e0amatplotlib\u7684\u56db\u5c42\u56fe\u50cf\u7ed3\u6784\uff0cpyplot\u6a21\u5757\u7ed8\u5236\u56fe\u5f62\u57fa\u672c\u90fd\u9075\u5faa\u4e00\u4e2a\u6d41\u7a0b\u3002<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/pyplot\u57fa\u672c\u7ed8\u56fe\u6d41\u7a0b.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/pyplot\u57fa\u672c\u7ed8\u56fe\u6d41\u7a0b.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<blockquote>\n<p>\u5bfc\u5165\u6a21\u5757<\/p>\n<\/blockquote>\n<p>\u5148\u5bfc\u5165\u76f8\u5e94\u5de5\u5177\u5305\u3002\u6839\u636e\u5b98\u65b9\u8ba4\u8bc1\u65b9\u5f0f\u5bfc\u5165\uff1a<\/p>\n<pre><code class=\"language-python\">import numpy as np\nimport matplotlib.pyplot as plt<\/code><\/pre>\n<blockquote>\n<p>\u521b\u5efa\u753b\u5e03\u548c\u5b50\u56fe<\/p>\n<\/blockquote>\n<p>\u9996\u5148\u521b\u5efa\u4e00\u5f20\u7a7a\u767d\u7684\u753b\u5e03\uff0c\u8bbe\u7f6e\u753b\u5e03\u5927\u5c0f\uff0c\u6839\u636e\u9700\u8981\u540c\u65f6\u5c55\u793a\u51e0\u4e2a\u56fe\u5f62\uff0c\u53ef\u4ee5\u5c06\u753b\u5e03\u5212\u5206\u4e3a\u591a\u4e2a\u90e8\u5206\u3002\u7136\u540e\u4f7f\u7528\u5bf9\u8c61\u65b9\u6cd5\u6765\u5b8c\u6210\u5176\u4f59\u7684\u5de5\u4f5c\u3002<\/p>\n<pre><code class=\"language-python\">pic = plt.figure(figsize=(10,10),dpi=80)  # \u521b\u5efa\u4e00\u4e2a10 x 10\u7684\u753b\u5e03\uff0c\u50cf\u7d20\u503c\u4e3a80\nax1 = pic.add_subplot(2,1,1)  # \u5212\u5206\u4e3a2 x 1\u7684\u56fe\u5f62\u9635\uff0c\u9009\u62e9\u7b2c\u4e00\u5f20\u56fe\u7247<\/code><\/pre>\n<blockquote>\n<p>\u6dfb\u52a0\u753b\u5e03\u5185\u5bb9<\/p>\n<\/blockquote>\n<p>\u7ed8\u56fe\u7684\u4e3b\u4f53\u90e8\u5206\u3002\u6dfb\u52a0\u6807\u9898\u3001\u5750\u6807\u8f74\u540d\u79f0\u7b49\u64cd\u4f5c\u4e0e\u7ed8\u5236\u56fe\u5f62\u65f6\u5e76\u5217\u7684\uff0c\u6ca1\u6709\u5148\u540e\u987a\u5e8f\uff0c\u53ef\u4ee5\u5148\u7ed8\u5236\u56fe\u5f62\uff0c\u4e5f\u53ef\u4ee5\u5148\u6dfb\u52a0\u5404\u7c7b\u6807\u7b7e\uff0c\u4f46\u662f\u6dfb\u52a0\u56fe\u4f8b\u4e00\u5b9a\u8981\u5728\u7ed8\u5236\u56fe\u5f62\u4e4b\u540e\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u65b9\u6cd5<\/th>\n<th style=\"text-align: center;\">\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">plt.title()<\/td>\n<td style=\"text-align: center;\">\u8bbe\u7f6e\u56fe\u50cf\u6807\u9898<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">plt.xlabel()<\/td>\n<td style=\"text-align: center;\">\u8bbe\u7f6ex\u8f74\u540d\u79f0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">plt.ylabel()<\/td>\n<td style=\"text-align: center;\">\u8bbe\u7f6ey\u8f74\u540d\u79f0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">plt.xlim()<\/td>\n<td style=\"text-align: center;\">\u8bbe\u7f6ex\u8f74\u8303\u56f4<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">plt.ylim()<\/td>\n<td style=\"text-align: center;\">\u8bbe\u7f6ey\u8f74\u8303\u56f4<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">plt.xticks()<\/td>\n<td style=\"text-align: center;\">\u8bbe\u7f6ex\u8f74\u523b\u5ea6<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">plt.yticks()<\/td>\n<td style=\"text-align: center;\">\u8bbe\u7f6ey\u8f74\u523b\u5ea6<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">plt.legend()<\/td>\n<td style=\"text-align: center;\">\u8bbe\u7f6e\u66f2\u7ebf\u56fe\u4f8b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<blockquote>\n<p>\u56fe\u5f62\u4fdd\u5b58\u4e0e\u5c55\u793a<\/p>\n<\/blockquote>\n<pre><code class=\"language-python\">plt.savefig(&#039;\u56fe\u7247\u540d\u79f0+\u540e\u7f00\u540d&#039;)  # \u4fdd\u5b58\u56fe\u7247\uff0c\u53ef\u4ee5\u81ea\u7531\u6307\u5b9a\u56fe\u7247\u683c\u5f0f\nplt.show()  # \u5c55\u793a\u56fe\u5f62<\/code><\/pre>\n<blockquote>\n<p>\u6574\u4f53\u6d41\u7a0b<\/p>\n<\/blockquote>\n<pre><code class=\"language-python\">import numpy as np\nimport matplotlib.pyplot as plt\n\nfig = plt.figure(figsize = (10,10),dpi = 80)  # \u521b\u5efa\u753b\u5e03\u3002\u5927\u5c0f10x10\uff0c\u50cf\u7d2080\nx = np.linspace(0,1,1000)  # \u901a\u8fc7numpy\u751f\u6210\u968f\u673a\u6570\nfig.add_subplot(2,1,1)  # \u5206\u4e3a2x1\u56fe\u5f62\u9635\uff0c\u9009\u62e9\u7b2c\u4e00\u5f20\u56fe\u7247\u7ed8\u56fe\nplt.title(&#039;y=x^2 or y=x&#039;)  # \u6dfb\u52a0\u6807\u9898\nplt.xlabel(&#039;x&#039;)  # \u6dfb\u52a0x\u8f74\u540d\u79f0\nplt.ylabel(&#039;y&#039;)  # \u6dfb\u52a0y\u8f74\u540d\u79f0\nplt.xlim((0,1))  # \u8bbe\u7f6ex\u8f74\u8303\u56f4\uff080\uff0c1\uff09\nplt.ylim((0,1))  # \u8bbe\u7f6ey\u8f74\u8303\u56f4\uff080\uff0c1\uff09\nplt.xticks([0,0.3,0.6,1])  # \u8bbe\u7f6ex\u8f74\u523b\u5ea6\nplt.yticks([0,0.5,1])  # \u8bbe\u7f6ey\u8f74\u523b\u5ea6\nplt.plot(x,x**2)\nplt.plot(x,x)\nplt.legend([&#039;y=x^2&#039;,&#039;y=x&#039;])  # \u6dfb\u52a0\u56fe\u4f8b\nplt.savefig(&#039;\u6574\u4f53\u7ed8\u56fe\u6d41\u7a0b.png&#039;)  # \u4fdd\u5b58\u56fe\u7247\nplt.show()  # \u5c55\u793a\u56fe\u7247<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u6574\u4f53\u7ed8\u56fe\u6d41\u7a0b.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u6574\u4f53\u7ed8\u56fe\u6d41\u7a0b.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<h2>2.3\u3001\u7ed8\u56fe\u98ce\u683c<\/h2>\n<p>\u5728matplotlib\u4e2d,pyplot\u7684\u4e00\u4e2a\u5b50\u6a21\u5757style\u5f53\u4e2d\u5b9a\u4e49\u4e86\u5f88\u591a\u9884\u8bbe\u98ce\u683c\uff0c\u65b9\u4fbf\u8fdb\u884c\u98ce\u683c\u8f6c\u6362\u3002\u6bcf\u4e2a\u9884\u8bbe\u98ce\u683c\u90fd\u5b58\u50a8\u5728\u4e00\u4e2a.mplstyle\u4e3a\u540e\u7f00\u7684style\u6587\u4ef6\u4e2d\u3002<\/p>\n<p>\u901a\u8fc7<code>print(plt.style.available)<\/code>\u53ef\u4ee5\u67e5\u770b\u6240\u6709\u9884\u8bbe\u98ce\u683c\u7684\u540d\u79f0\uff0c\u901a\u8fc7use\u51fd\u6570\u5c31\u53ef\u4ee5\u76f4\u63a5\u8bbe\u7f6e\u9884\u8bbe\u98ce\u683c\u3002<\/p>\n<blockquote>\n<p>\u67e5\u770b\u6240\u6709\u98ce\u683c\u540d\u79f0<\/p>\n<\/blockquote>\n<pre><code class=\"language-python\">print(plt.style.available)\n\n&quot;&quot;&quot;\n[&#039;seaborn-dark&#039;, &#039;seaborn-darkgrid&#039;, &#039;seaborn-ticks&#039;, &#039;fivethirtyeight&#039;, &#039;seaborn-whitegrid&#039;, &#039;classic&#039;, &#039;_classic_test&#039;, &#039;fast&#039;, &#039;seaborn-talk&#039;, &#039;seaborn-dark-palette&#039;, &#039;seaborn-bright&#039;, &#039;seaborn-pastel&#039;, &#039;grayscale&#039;, &#039;seaborn-notebook&#039;, &#039;ggplot&#039;, &#039;seaborn-colorblind&#039;, &#039;seaborn-muted&#039;, &#039;seaborn&#039;, &#039;Solarize_Light2&#039;, &#039;seaborn-paper&#039;, &#039;bmh&#039;, &#039;tableau-colorblind10&#039;, &#039;seaborn-white&#039;, &#039;dark_background&#039;, &#039;seaborn-poster&#039;, &#039;seaborn-deep&#039;]\n&quot;&quot;&quot;<\/code><\/pre>\n<blockquote>\n<p>\u4fee\u6539\u98ce\u683c<\/p>\n<\/blockquote>\n<pre><code class=\"language-python\">x = np.linspace(0,1,1000)\nplt.title(&#039;title&#039;)\nplt.style.use(&#039;classic&#039;)  # \u4f7f\u7528classic\u98ce\u683c\nplt.plot(x,x ** 2)\nplt.plot(x,x)\nplt.legend([&#039;y=x^2&#039;,&#039;y=x&#039;])<\/code><\/pre>\n<h2>2.4\u3001\u52a8\u6001rc\u53c2\u6570<\/h2>\n<p>pyplot\u6a21\u5757\u4f7f\u7528rc\u914d\u7f6e\u6587\u4ef6\u6765\u81ea\u5b9a\u4e49\u56fe\u5f62\u7684\u5404\u79cd\u9ed8\u8ba4\u5c5e\u6027\uff0c\u79f0\u4e3arc\u914d\u7f6e\u6216rc\u53c2\u6570\u3002\u901a\u8fc7\u4fee\u6539rc\u53c2\u6570\u53ef\u4ee5\u4fee\u6539\u9ed8\u8ba4\u7684\u5c5e\u6027\uff0c\u5305\u62ec\u7a97\u4f53\u5927\u5c0f\u3001\u6bcf\u82f1\u5bf8\u7684\u70b9\u6570\u3001\u7ebf\u6761\u5bbd\u5ea6\u3001\u989c\u8272\u3001\u6837\u5f0f\u3001\u5750\u6807\u8f74\u3001\u5750\u6807\u548c\u7f51\u7edc\u5c5e\u6027\u3001\u6587\u672c\u3001\u5b57\u4f53\u7b49\u3002<\/p>\n<p>\u200b   matplotlib\u5c06\u9ed8\u8ba4\u53c2\u6570\u914d\u7f6e\u4fdd\u5b58\u5728matplotlibrc\u6587\u4ef6\u4e2d\uff0c\u901a\u8fc7\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\uff0c\u53ef\u4fee\u6539\u56fe\u6807\u7684\u7684\u7f3a\u7701\u6837\u5f0f\u3002\u67e5\u770b\u9ed8\u8ba4\u914d\u7f6e\u7684\u65b9\u5f0f\u5982\u4e0b\uff1a<\/p>\n<p>1\uff09\u76f4\u63a5\u6253\u5f00matplotlibrc\u6587\u4ef6<\/p>\n<p>2\uff09<code>print(matplotlib.rc_params())<\/code><\/p>\n<p>3\uff09<code>print(matplotlib.rcParamsDefault)<\/code><\/p>\n<p>4\uff09<code>print(matplotlib.rcParams)<\/code><\/p>\n<h3>1\u3001\u7ebf\u6761\u5e38\u7528\u7684rc\u53c2\u6570<\/h3>\n<p>\u7ba1\u7406\u7ebf\u6761\u5c5e\u6027\u7684rc\u53c2\u6570lines\u51e0\u4e4e\u53ef\u4ee5\u63a7\u5236\u7ebf\u6761\u7684\u6bcf\u4e00\u4e2a\u7ec6\u8282\u3002<\/p>\n<blockquote>\n<p>\u7ebf\u6761\u7684\u5e38\u7528rc\u53c2\u6570\u540d\u79f0\u3001\u89e3\u91ca\u4e0e\u53d6\u503c<\/p>\n<\/blockquote>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">rc\u53c2\u6570\u540d\u79f0<\/th>\n<th style=\"text-align: center;\">\u89e3\u91ca<\/th>\n<th style=\"text-align: center;\">\u53d6\u503c<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">lines.linewidth<\/td>\n<td style=\"text-align: center;\">\u7ebf\u6761\u5bbd\u5ea6<\/td>\n<td style=\"text-align: center;\">\u53d60~10\u4e4b\u95f4\u7684\u6570\u503c\uff0c\u9ed8\u8ba4\u4e3a1.5<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">lines.linestyle<\/td>\n<td style=\"text-align: center;\">\u7ebf\u6761\u6837\u5f0f<\/td>\n<td style=\"text-align: center;\">\u53ef\u53d6\u201c-\u201d\uff0c\u201c\u2014\u201d\uff0c\u201c-.\u201d\uff0c\u201c:\u201d4\u4e2d\uff0c\u9ed8\u8ba4\u4e3a\u201c&#8211;\u201d<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">lines.marker<\/td>\n<td style=\"text-align: center;\">\u7ebf\u6761\u4e0a\u70b9\u7684\u5f62\u72b6<\/td>\n<td style=\"text-align: center;\">\u53ef\u53d6\u201co\u201d,&quot;D&quot;,&quot;h&quot;,&quot;.&quot;,&quot;,&quot;,&quot;S&quot;\u7b4920\u79cd\uff0c\u9ed8\u8ba4\u4e3aNone<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">lines.markersize<\/td>\n<td style=\"text-align: center;\">\u70b9\u7684\u5927\u5c0f<\/td>\n<td style=\"text-align: center;\">\u53d60\uff5e10\u6570\u503c\uff0c\u9ed8\u8ba4\u4e3a1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre><code class=\"language-python\">import matplotlib as mpl\n\nfig = plt.figure(figsize = (10,10),dpi = 80)  # \u521b\u5efa\u753b\u5e03\u3002\u5927\u5c0f10x10\uff0c\u50cf\u7d2080\nx = np.linspace(0,1,1000)  # \u901a\u8fc7numpy\u751f\u6210\u968f\u673a\u6570\n\n# \u7ed8\u5236\u7b2c\u4e00\u5f20\u5b50\u56fe\nfig.add_subplot(2,2,1)  # \u5206\u4e3a2x2\u56fe\u5f62\u9635\uff0c\u9009\u62e9\u7b2c\u4e00\u5f20\u56fe\u7247\u7ed8\u56fe\nplt.rcParams[&#039;lines.linestyle&#039;] = &#039;-.&#039;  # \u4fee\u6539\u7ebf\u6761\u7c7b\u578b\nplt.rcParams[&#039;lines.linewidth&#039;] = 1  # \u4fee\u6539\u7ebf\u6761\u5bbd\u5ea6\nplt.plot(x,x**2)\nplt.title(&#039;y=x^2&#039;)  # \u6dfb\u52a0\u6807\u9898\n\n# \u7ed8\u5236\u7b2c\u4e8c\u5f20\u5b50\u56fe\n\nfig.add_subplot(2,2,2)  # \u5206\u4e3a2x2\u56fe\u5f62\u9635\uff0c\u9009\u62e9\u7b2c\u4e8c\u5f20\u56fe\u7247\u7ed8\u56fe\nmpl.rc(&#039;lines&#039;,linestyle = &#039;--&#039;, linewidth = 10)\nplt.plot(x,x**2)\nplt.title(&#039;y=x^2&#039;)  # \u6dfb\u52a0\u6807\u9898\n\n# \u7ed8\u5236\u7b2c\u4e09\u5f20\u5b50\u56fe\nfig.add_subplot(2,2,3)  # \u5206\u4e3a2x2\u56fe\u5f62\u9635\uff0c\u9009\u62e9\u7b2c\u4e09\u5f20\u56fe\u7247\u7ed8\u56fe\nplt.rcParams[&#039;lines.marker&#039;] = None\nplt.rcParams[&#039;lines.linewidth&#039;] = 3\nplt.plot(x,x**2)\nplt.title(&#039;y=x^2&#039;)  # \u6dfb\u52a0\u6807\u9898\n\n# \u7ed8\u5236\u7b2c\u56db\u5f20\u5b50\u56fe\nfig.add_subplot(2,2,4)  # \u5206\u4e3a2x2\u56fe\u5f62\u9635\uff0c\u9009\u62e9\u7b2c\u56db\u5f20\u56fe\u7247\u7ed8\u56fe\nplt.rcParams[&#039;lines.linestyle&#039;] = &#039;:&#039;\nplt.rcParams[&#039;lines.linewidth&#039;] = 6\nplt.plot(x,x**2)\nplt.title(&#039;y=x^2&#039;)  # \u6dfb\u52a0\u6807\u9898\n\nplt.savefig(&#039;\u4fee\u6539\u7ebf\u6761\u7684rc\u53c2\u6570.png&#039;)\nplt.show()<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u4fee\u6539rc\u53c2\u6570.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u4fee\u6539rc\u53c2\u6570.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<h3>2\u3001\u5750\u6807\u8f74\u5e38\u7528\u7684rc\u53c2\u6570<\/h3>\n<p>\u540c\u6837\uff0c\u7ba1\u7406\u5750\u6807\u8f74\u5c5e\u6027\u7684rc\u53c2\u6570axes\u4e5f\u80fd\u63a7\u5236\u5750\u6807\u8f74\u7684\u4efb\u610f\u7ec6\u8282\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">rc\u53c2\u6570\u540d\u79f0<\/th>\n<th style=\"text-align: center;\">\u89e3\u91ca<\/th>\n<th style=\"text-align: center;\">\u53d6\u503c<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">axas.facecolor<\/td>\n<td style=\"text-align: center;\">\u80cc\u666f\u989c\u8272<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536\u989c\u8272\u7b80\u5199\u5b57\u7b26\u3002\u9ed8\u8ba4\u4e3a\u201cW\u201d<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">axas.edgecolor<\/td>\n<td style=\"text-align: center;\">\u8fb9\u7ebf\u989c\u8272<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536\u989c\u8272\u7b80\u5199\u5b57\u7b26\u3002\u9ed8\u8ba4\u4e3a\u201ck\u201d<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">axas.linewidth<\/td>\n<td style=\"text-align: center;\">\u8f74\u7ebf\u5bbd\u5ea6<\/td>\n<td style=\"text-align: center;\">\u63a5\u65360\uff5e1\u7684float\u3002\u9ed8\u8ba4\u4e3a0.8<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">axas.grid<\/td>\n<td style=\"text-align: center;\">\u6dfb\u52a0\u7f51\u683c<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536bool\u3002\u9ed8\u8ba4\u4e3aFalse<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">axas.titlesize<\/td>\n<td style=\"text-align: center;\">\u6807\u9898\u5927\u5c0f<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536\u2018small\u2019,\u2018medium\u2019,&#8217;large&#8217;\u3002\u9ed8\u8ba4\u4e3a\u2018large\u2019<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">axas.labelsize<\/td>\n<td style=\"text-align: center;\">\u8f74\u6807\u5927\u5c0f<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536\u2018small\u2019,\u2018medium\u2019,&#8217;large&#8217;\u3002\u9ed8\u8ba4\u4e3a\u2018medium\u2019<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">axas.lablelcolor<\/td>\n<td style=\"text-align: center;\">\u8f74\u6807\u989c\u8272<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536\u989c\u8272\u7b80\u5199\u5b57\u7b26\u3002\u9ed8\u8ba4\u4e3a\u201ck\u201d<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">axas.spines.{left,botton,top,tight}<\/td>\n<td style=\"text-align: center;\">\u6dfb\u52a0\u5750\u6807\u8f74<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536bool\u3002\u9ed8\u8ba4\u4e3aTrue<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">axas.{x,y}margin<\/td>\n<td style=\"text-align: center;\">\u8f74\u4f59\u7559<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536float\u3002\u9ed8\u8ba4\u4e3a0.05<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u539f\u8f74\uff1a<\/p>\n<pre><code class=\"language-python\">x = np.linspace(0,10,1000)\nplt.plot(x, np.sin(x))\nplt.show()<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u539f\u8f74.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u539f\u8f74.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<p>\u4fee\u6539rc\u53c2\u6570\u4e4b\u540e\u7684\u8f74\uff1a<\/p>\n<pre><code class=\"language-python\">x = np.linspace(0,10,1000)\nplt.rcParams[&#039;axes.edgecolor&#039;] = &#039;b&#039;  # \u8f74\u989c\u8272\u8bbe\u7f6e\u4e3a\u84dd\u8272\nplt.rcParams[&#039;axes.grid&#039;] = True  # \u6dfb\u52a0\u7f51\u683c\nplt.rcParams[&#039;axes.spines.top&#039;] = False  # \u53bb\u9664\u9876\u90e8\u8f74\nplt.rcParams[&#039;axes.spines.right&#039;] = False  # \u53bb\u9664\u53f3\u4fa7\u8f74\nplt.rcParams[&#039;axes.xmargin&#039;] = 0.1  # x\u8f74\u4f59\u7559\u4e3a\u533a\u95f4\u957f\u5ea6\u76840.1\u500d\nplt.plot(x, np.sin(x))\nplt.show()\n<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u4fee\u6539rc.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u4fee\u6539rc.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<h3>3\u3001\u5b57\u4f53\u5e38\u7528\u7684rc\u53c2\u6570<\/h3>\n<p>\u200b   \u5176\u5b9e\u7528\u5230\u73b0\u5728\uff0c\u53ef\u80fd\u6709\u4e9b\u540c\u5b66\u5df2\u7ecf\u53d1\u73b0\uff0c\u9ed8\u8ba4\u7684pyplot\u5b57\u4f53\uff0c\u5e76\u4e0d\u652f\u6301\u4e2d\u6587\u5b57\u7b26\uff0c\u56e0\u6b64\u9700\u8981\u901a\u8fc7\u4fee\u6539<code>font.sans-serif<\/code>\u53c2\u6570\u6765\u4fee\u6539\u7ed8\u56fe\u65f6\u7684\u5b57\u4f53\uff0c\u4f7f\u5f97\u56fe\u5f62\u53ef\u4ee5\u6b63\u5e38\u663e\u793a\u4e2d\u6587\u3002\u540c\u65f6\u7531\u4e8e\u4fee\u6539\u5b57\u4f53\u540e\u4f1a\u5bfc\u81f4\u5750\u6807\u8f74\u4e2d\u8d1f\u53f7\u65e0\u6cd5\u6b63\u5e38\u663e\u793a\uff0c\u56e0\u6b64\u9700\u8981\u540c\u65f6\u4fee\u6539axes.uncode_minus\u53c2\u6570\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">rc\u53c2\u6570\u540d\u79f0<\/th>\n<th style=\"text-align: center;\">\u89e3\u91ca<\/th>\n<th style=\"text-align: center;\">\u53d6\u503c<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">font.family<\/td>\n<td style=\"text-align: center;\">\u5b57\u4f53\u65cf\uff0c\u6bcf\u4e00\u65cf\u5bf9\u5e94\u591a\u79cd\u5b57\u4f53<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536serif\u3001sans-serif\u3001cursive\u3001fantasy\u3001monospace\u4e94\u79cd\u3002\u9ed8\u8ba4\u4e3asans-serif<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">font.style<\/td>\n<td style=\"text-align: center;\">\u5b57\u4f53\u98ce\u683c<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536normal(roman)\u3001italic\u3001oblique\u4e09\u79cd\uff0c\u9ed8\u8ba4\u4e3anormal<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">font.variant<\/td>\n<td style=\"text-align: center;\">\u5b57\u4f53\u53d8\u5316<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536normal\u6216small-caps\u3002\u9ed8\u8ba4\u4e3anormal<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">font.widget<\/td>\n<td style=\"text-align: center;\">\u5b57\u4f53\u91cd\u91cf<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536normal\u3001bold\u3001bolder\u3001lighter\u56db\u79cd\u53ca100\u3001200\u3001\u2026\u3001900.\u9ed8\u8ba4\u4e3anomal<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">font.stretch<\/td>\n<td style=\"text-align: center;\">\u5b57\u4f53\u5ef6\u4f38<\/td>\n<td style=\"text-align: center;\"><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">font.size<\/td>\n<td style=\"text-align: center;\">\u5b57\u4f53\u5927\u5c0f<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536float\u3002\u9ed8\u8ba4\u4e3a10<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>2.4\u3001\u6298\u7ebf\u56fe<\/h2>\n<p>\u6298\u7ebf\u56fe\u662f\u5c06&quot;\u6563\u70b9&quot;\u6309\u7167\u6a2a\u5750\u6807\u987a\u5e8f\u7528\u7ebf\u6bb5\u4f9d\u6b21\u8fde\u63a5\u8d77\u6765\u7684\u56fe\u5f62\u3002\u4ee5\u6298\u7ebf\u7684\u4e0a\u5347\u6216\u4e0b\u964d\u8868\u793a\u67d0\u4e00\u7279\u5f81\u968f\u53e6\u5916\u4e00\u7279\u5f81\u53d8\u5316\u7684\u589e\u51cf\u4ee5\u53ca\u603b\u4f53\u53d8\u5316\u8d8b\u52bf\u3002\u4e00\u822c\u7528\u4e8e\u5c55\u73b0\u67d0\u4e00\u7279\u5f81\u968f\u65f6\u95f4\u7684\u53d8\u5316\u8d8b\u52bf\u3002<\/p>\n<blockquote>\n<p>plot\u51fd\u6570\u5e38\u7528\u53c2\u6570\u53ca\u5176\u8bf4\u660e<\/p>\n<\/blockquote>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u53c2\u6570<\/th>\n<th style=\"text-align: center;\">\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">x,y<\/td>\n<td style=\"text-align: center;\">\u5206\u522b\u8868\u793ax\u8f74\u548cy\u8f74\u7684\u6570\u636e\u3002\u65e0\u9ed8\u8ba4\u503c<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">color<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536\u7279\u5b9astr\uff0c\u6307\u5b9a\u7ebf\u6761\u7684\u989c\u8272\u3002\u9ed8\u8ba4\u4e3aNone<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">linestyle<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536\u7279\u5b9astr\uff0c\u6307\u5b9a\u7ebf\u6761\u7c7b\u578b\u3002\u9ed8\u8ba4\u4e3a \u201c-\u201d<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">marker<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536\u7279\u5b9astr\uff0c\u8868\u793a\u7ed8\u5236\u7684\u70b9\u7684\u5f62\u72b6\u3002\u9ed8\u8ba4\u4e3aNone<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">alpha<\/td>\n<td style=\"text-align: center;\">\u63a5\u65360\uff5e1\u7684\u5c0f\u8bf4\uff0c\u8868\u793a\u70b9\u7684\u900f\u660e\u5ea6\u3002\u9ed8\u8ba4\u4e3aNone<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5176\u4e2dcolor\u53c2\u6570\u76848\u79cd\u5e38\u7528\u989c\u8272\u7684\u7f29\u5199\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u989c\u8272\u7f29\u5199<\/th>\n<th style=\"text-align: center;\">\u4ee3\u8868\u7684\u989c\u8272<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">b<\/td>\n<td style=\"text-align: center;\">\u84dd\u8272<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">g<\/td>\n<td style=\"text-align: center;\">\u7eff\u8272<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">r<\/td>\n<td style=\"text-align: center;\">\u7ea2\u8272<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">c<\/td>\n<td style=\"text-align: center;\">\u9752\u8272<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">m<\/td>\n<td style=\"text-align: center;\">\u54c1\u7ea2<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">y<\/td>\n<td style=\"text-align: center;\">\u9ec4\u8272<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">k<\/td>\n<td style=\"text-align: center;\">\u9ed1\u8272<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">w<\/td>\n<td style=\"text-align: center;\">\u767d\u8272<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre><code class=\"language-python\">plt.plot([0,3,9,15,30],linestyle = &#039;-.&#039;,color = &#039;r&#039;,marker = &#039;o&#039;) \n<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/matplot2.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/matplot2.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<blockquote>\n<p>axis\u51fd\u6570<\/p>\n<\/blockquote>\n<pre><code class=\"language-python\">plt.plot(y.cumsum())\n\nplt.grid(True)\nplt.axis(&#039;image&#039;)\n<\/code><\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/axis\u793a\u4f8b.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/axis\u793a\u4f8b.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<p>\u63a5\u4e0b\u6765\u4e3b\u8981\u4ecb\u7ecdaxis\u51fd\u6570\u7684\u4e00\u4e9b\u53c2\u6570\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u53c2\u6570<\/th>\n<th style=\"text-align: center;\">\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">Empty<\/td>\n<td style=\"text-align: center;\">\u8fd4\u56de\u5f53\u524d\u5750\u6807\u8f74\u9650\u503c<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">off<\/td>\n<td style=\"text-align: center;\">\u5173\u95ed\u5750\u6807\u8f74\u7ebf\u548c\u6807\u7b7e<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">equal<\/td>\n<td style=\"text-align: center;\">\u4f7f\u7528\u7b49\u523b\u5ea6<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">scaled<\/td>\n<td style=\"text-align: center;\">\u901a\u8fc7\u5c3a\u5bf8\u53d8\u5316\u5e73\u8861\u523b\u5ea6<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">tight<\/td>\n<td style=\"text-align: center;\">\u4f7f\u6240\u6709\u6570\u636e\u53ef\u89c1\uff08\u7f29\u5c0f\u9650\u503c\uff09<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">image<\/td>\n<td style=\"text-align: center;\">\u4f7f\u6240\u6709\u6570\u636e\u53ef\u89c1\uff08\u4f7f\u7528\u6570\u636e\u9650\u503c\uff09<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">[xmin,xmax,ymin,ymax]<\/td>\n<td style=\"text-align: center;\">\u5c06\u8bbe\u7f6e\u9650\u5236\u4e3a\u7ed9\u5b9a\u7684\uff08\u4e00\u7ec4\uff09\u503c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>2.2\u3001\u4e8c\u7ef4\u6570\u636e\u96c6<\/h2>\n<p>\u4e00\u7ef4\u6570\u636e\u7ed8\u56fe\u53ea\u80fd\u8bf4\u662f\u4e00\u79cd\u7279\u4f8b\uff0c\u4e00\u822c\u6765\u8bf4\uff0c\u6570\u636e\u96c6\u5305\u542b\u591a\u4e2a\u5355\u72ec\u7684\u5b50\u96c6\u3002\u8fd9\u4e9b\u6570\u636e\u7684\u5904\u7406\u4e5f\u662f\u540c\u6837\u9075\u5faamatplotlib\u5904\u7406\u4e00\u7ef4\u6570\u636e\u65f6\u7684\u539f\u5219\u3002\u4f46\u662f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4f1a\u51fa\u73b0\u4e00\u4e9b\u5176\u4ed6\u7684\u95ee\u9898\uff0c\u4f8b\u5982\uff0c\u4e24\u4e2a\u6570\u636e\u96c6\u5b83\u4eec\u53ef\u80fd\u4f1a\u6709\u4e0d\u540c\u7684\u523b\u5ea6\uff0c\u65e0\u6cd5\u7528\u76f8\u540c\u7684y\u6216\u8005x\u8f74\u523b\u5ea6\u8fdb\u884c\u7ed8\u5236\uff0c\u8fd8\u6709\u53ef\u80fd\u5e0c\u671b\u4ee5\u4e0d\u540c\u7684\u65b9\u5f0f\u53ef\u89c6\u5316\u4e24\u7ec4\u4e0d\u540c\u7684\u6570\u636e\uff0c\u4f8b\u5982\uff0c\u4e00\u7ec4\u6570\u636e\u4f7f\u7528\u7ebf\u56fe\uff0c\u53e6\u4e00\u7ec4\u4f7f\u7528\u67f1\u72b6\u56fe\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u9996\u5148\u751f\u6210\u4e00\u4e2a\u4e8c\u7ef4\u6837\u672c\u6570\u636e\u3002<\/p>\n<pre><code class=\"language-python\">np.random.seed(2000)\ny = np.random.standard_normal((20,2)).cumsum(axis=0)\n<\/code><\/pre>\n<p>\u4ee5\u4e0a\u4ee3\u7801\u751f\u6210\u7684\u662f\u4e00\u4e2a\u5305\u542b\u6807\u51c6\u6b63\u6001\u5206\u5e03\u968f\u673a\u6570\u768420*2\u7684ndarray\u6570\u7ec4\uff0c\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-python\">array([[ 1.73673761,  1.89791391],\n       [-0.37003581,  1.74900181],\n       [ 0.21302575, -0.51023122],\n       [ 0.35026529, -1.21144444],\n       [-0.27051479, -1.6910642 ],\n       [ 0.93922398, -2.76624806],\n       [ 1.74614319, -3.05703153],\n       [ 1.52519555, -3.22618757],\n       [ 2.62602999, -3.14367705],\n       [ 2.6216544 , -4.8662353 ],\n       [ 3.67921082, -7.38414811],\n       [ 1.7685707 , -6.07769276],\n       [ 2.19296834, -6.54686084],\n       [ 1.18689581, -7.46878388],\n       [ 1.81330034, -7.11160718],\n       [ 1.79458178, -6.89043591],\n       [ 2.49318589, -6.05592589],\n       [ 0.82754806, -8.95736573],\n       [ 0.77890953, -9.00274406],\n       [ 2.25424343, -9.51643749]])\n<\/code><\/pre>\n<p>\u5c06\u8fd9\u6837\u7684\u4e8c\u7ef4\u6570\u7ec4\u4f20\u9012\u7ed9plot\u51fd\u6570\uff0c\u4ed6\u5c06\u81ea\u52a8\u628a\u5305\u542b\u7684\u6570\u636e\u89e3\u91ca\u4e3a\u5355\u72ec\u7684\u6570\u636e\u96c6\u3002<\/p>\n<pre><code class=\"language-python\">plt.figure(figsize=(7,4))\nplt.plot(y,lw=1.5)\nplt.plot(y,&quot;rd&quot;)\nplt.axis(&#039;tight&#039;)\n<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u4e8c\u7ef4\u6570\u636e\u96c61.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u4e8c\u7ef4\u6570\u636e\u96c61.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<p>\u50cf\u8fd9\u79cd\u6570\u636e\u80af\u5b9a\u5c31\u662f\u770b\u7684\u4e00\u5934\u4e71\u9ebb\uff0c\u6240\u4ee5\u8bf4\u6211\u4eec\u9700\u8981\u5c06\u5b83\u8fdb\u4e00\u6b65\u505a\u4e00\u4e0b\u6ce8\u91ca\uff0c\u4e3a\u4e86\u8ba9\u6211\u4eec\u80fd\u66f4\u597d\u7684\u7406\u89e3\u56fe\u8868\u3002<\/p>\n<pre><code class=\"language-python\">plt.figure(figsize=(7,4))\n\n# \u5206\u522b\u4e3a\u4e24\u6761\u6570\u636e\u6dfb\u52a0\u56fe\u4f8b\nplt.plot(y[:,0],lw=1.5,label=&#039;1st&#039;)  \nplt.plot(y[:,1],lw=1.5,label=&#039;2nd&#039;)\nplt.plot(y,&quot;rd&quot;)\nplt.grid(True)  # \u7f51\u683c\u8bbe\u7f6e\nplt.legend(loc=0)  # \u56fe\u4f8b\u6807\u7b7e\u4f4d\u7f6e\u8bbe\u7f6e\nplt.axis(&#039;tight&#039;)\nplt.xlabel(&#039;index&#039;)\nplt.ylabel(&#039;value&#039;)\nplt.title(&#039;test1&#039;)\n<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/test1.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/test1.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<p>\u901a\u8fc7\u521a\u624d\u7684\u64cd\u4f5c\u6211\u4eec\u4e5f\u80fd\u591f\u53d1\u73b0\uff0c\u867d\u7136\u6211\u4eec\u4f20\u8fdb\u7684\u662f\u4e00\u4e2andarray\u6570\u7ec4\uff0c\u4f46\u662f\u5b83\u662f\u4e00\u4e2a\u4e8c\u7ef4\u6570\u7ec4\uff0c\u6240\u4ee5\u6211\u4eec\u8981\u60f3\u5c06\u6570\u636e\u5168\u90e8\u5c55\u793a\u51fa\u6765\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e0a\u9762\u90a3\u79cd\u65b9\u5f0f\uff0c\u4f46\u662f\u4e0a\u9762\u7684\u6570\u636e\u523b\u5ea6\u90fd\u662f\u76f8\u5dee\u65e0\u51e0\u7684\uff0c\u5982\u679c\u8bf4\u67d0\u4e00\u7ef4\u7684\u6570\u636e\u975e\u5e38\u5927\uff0c\u800c\u53e6\u5916\u4e00\u7ef4\u7684\u5219\u90fd\u662f\u4e00\u4e9b\u5c0f\u6570\u636e\uff0c\u90a3\u8981\u600e\u4e48\u529e\u5462\u3002<\/p>\n<p>\u9996\u5148\u5148\u6765\u770b\u770b\u4f1a\u9020\u6210\u4ec0\u4e48\u6837\u7684\u7ed3\u679c\uff1a<\/p>\n<pre><code class=\"language-python\">y[:,0] = y[:,0] * 100\nplt.figure(figsize=(7,4))\nplt.plot(y[:,0],lw=1.5,label=&#039;1st&#039;)\nplt.plot(y[:,1],lw=1.5,label=&#039;2nd&#039;)\nplt.plot(y,&quot;rd&quot;)\nplt.grid(True)  # \u7f51\u683c\u8bbe\u7f6e\nplt.legend(loc=0)  # \u56fe\u4f8b\u6807\u7b7e\u4f4d\u7f6e\u8bbe\u7f6e\nplt.axis(&quot;tight&quot;)\nplt.xlabel(&#039;index&#039;)\nplt.ylabel(&#039;value&#039;)\nplt.title(&quot;test2&quot;)\n<\/code><\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/test2.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/test2.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<p>\u7b2c\u4e00\u4e2a\u6570\u636e\u7531\u4e8e\u6570\u636e\u91cf\u5927\uff0c\u6240\u4ee5\u5728\u8fd9\u4e48\u5927\u7684\u523b\u5ea6\u4e0a\u4f9d\u7136\u53ef\u4ee5\u5c06\u6570\u636e\u663e\u793a\u6bd4\u8f83\u597d\u8fa8\u8ba4\uff0c\u800c\u7b2c\u4e8c\u4e2a\u6570\u636e\u5c31\u4f1a\u56e0\u4e3a\u8fd9\u4e2a\u539f\u56e0\u770b\u8d77\u6765\u50cf\u4e00\u6761\u76f4\u7ebf\uff0c\u6211\u4eec\u5df2\u7ecf\u4e0d\u80fd\u901a\u8fc7\u56fe\u50cf\u89c2\u5bdf\u5b83\u7684\u6570\u636e\u6548\u679c\u3002<\/p>\n<blockquote>\n<p>\u5904\u7406\u65b9\u5f0f\uff1a<\/p>\n<\/blockquote>\n<ul>\n<li>\u4f7f\u7528\u4e24\u4e2ay\u8f74\uff08\u4e00\u5de6\u4e00\u53f3\uff09<\/li>\n<li>\u4f7f\u7528\u4e24\u4e2a\u5b50\u56fe<\/li>\n<\/ul>\n<p>\u9996\u5148\u5148\u6765\u770b\u7b2c\u4e00\u79cd\u65b9\u6cd5\uff1a<\/p>\n<pre><code class=\"language-python\">fig,ax1 = plt.subplots()\n# \u7b2c\u4e00\u7ec4\u6570\u636e\nplt.plot(y[:,0],lw=1.5,label=&#039;1st&#039;)\nplt.plot(y[:,0],&quot;rd&quot;)\nplt.grid(True)  # \u7f51\u683c\u8bbe\u7f6e\nplt.legend(loc=8)  # \u56fe\u4f8b\u6807\u7b7e\u4f4d\u7f6e\u8bbe\u7f6e\nplt.axis(&quot;tight&quot;)\nplt.xlabel(&#039;index&#039;)\nplt.ylabel(&#039;value 1st&#039;)\n\n# \u7b2c\u4e8c\u7ec4\u6570\u636e\nax2 = ax1.twinx()\nplt.plot(y[:,1],&#039;g&#039;,lw=1.5,label=&#039;2nd&#039;)\nplt.plot(y[:,1],&#039;bd&#039;)\nplt.legend(loc=0)\nplt.ylabel(&quot;value 2nd&quot;)\n\nplt.title(&quot;test3&quot;)\n<\/code><\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/test3.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/test3.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<p>\u8fd9\u662f\u901a\u8fc7\u5728\u4e00\u5f20\u56fe\u4e0a\u901a\u8fc7\u4e0d\u540c\u7684\u523b\u5ea6\u6765\u5c55\u793a\u4e0d\u540c\u7684\u6570\u636e\u3002<\/p>\n<p>\u7b2c\u4e8c\u79cd\u65b9\u5f0f\uff1a<\/p>\n<pre><code class=\"language-python\">plt.figure(figsize=(7,5))\nplt.subplot(211)  # \u6307\u5b9a\u5b50\u56fe\u4f4d\u7f6e\uff0c\u4e09\u4e2a\u53c2\u6570\uff1a\u884c\u6570\u3001\u5217\u6570\u3001\u5b50\u56fe\u7f16\u53f7\nplt.plot(y[:,0],lw=1.5,label=&#039;1st&#039;)\nplt.plot(y[:,0],&quot;rd&quot;)\nplt.grid(True)  # \u7f51\u683c\u8bbe\u7f6e\nplt.legend(loc=0)  # \u56fe\u4f8b\u6807\u7b7e\u4f4d\u7f6e\u8bbe\u7f6e\nplt.axis(&quot;tight&quot;)\nplt.ylabel(&#039;value&#039;)\n\nplt.title(&quot;test4&quot;)\n\nplt.subplot(212)\nplt.plot(y[:,1],&#039;g&#039;,lw=1.5,label=&#039;2nd&#039;)\nplt.plot(y[:,1],&#039;rd&#039;)\nplt.grid(True)  # \u7f51\u683c\u8bbe\u7f6e\nplt.legend(loc=0)  # \u56fe\u4f8b\u6807\u7b7e\u4f4d\u7f6e\u8bbe\u7f6e\nplt.axis(&quot;tight&quot;)\nplt.xlabel(&#039;index&#039;)\nplt.ylabel(&#039;value&#039;)\n<\/code><\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/test4.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/test4.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<p>\u4ee5\u4e0a\u64cd\u4f5c\u90fd\u662f\u901a\u8fc7\u6298\u7ebf\u56fe\u6765\u5b9e\u73b0\u7684\uff0c\u4f46\u662f\u5728matplotlib\u5f53\u4e2d\u8fd8\u652f\u6301\u5f88\u591a\u79cd\u7c7b\u578b\u7684\u56fe\u50cf\u3002<\/p>\n<h2>2.3\u3001plt\u5bf9\u8c61\u652f\u6301\u7684\u56fe\u7c7b\u578b<\/h2>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u51fd\u6570<\/th>\n<th style=\"text-align: center;\">\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">plt.plot(x,y,fmt)<\/td>\n<td style=\"text-align: center;\">\u5750\u6807\u7cfb<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">plt.boxplot(data,notch,position)<\/td>\n<td style=\"text-align: center;\">\u7bb1\u578b\u56fe<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">plt.bar(left,height,width,bottom)<\/td>\n<td style=\"text-align: center;\">\u67f1\u72b6\u56fe<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">plt.barh(width,bottom,left,height)<\/td>\n<td style=\"text-align: center;\">\u6a2a\u5411\u67f1\u72b6\u56fe<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">plt.polar(theta,r)<\/td>\n<td style=\"text-align: center;\">\u6781\u5750\u6807\u7cfb<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">plt.pie(data,explode)<\/td>\n<td style=\"text-align: center;\">\u997c\u56fe<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">plt.psd(x,NFFT=256,pad_to,Fs)<\/td>\n<td style=\"text-align: center;\">\u529f\u7387\u8c31\u5bc6\u5ea6\u56fe<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">plt.specgram(x,NFFT=256,pad_to,F)<\/td>\n<td style=\"text-align: center;\">\u8c31\u56fe<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">plt.cohere(x,y,NFFT=256,Fs)<\/td>\n<td style=\"text-align: center;\">X-Y\u76f8\u5173\u6027\u51fd\u6570<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">plt.scatter(x,y)<\/td>\n<td style=\"text-align: center;\">\u6563\u70b9\u56fe<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">plt.step(x,y,where)<\/td>\n<td style=\"text-align: center;\">\u6b65\u9636\u56fe<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">plt.hist(x,bins,normed)<\/td>\n<td style=\"text-align: center;\">\u76f4\u65b9\u56fe<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>2.3.1\u3001\u67f1\u72b6\u56fe<\/h3>\n<pre><code class=\"language-python\"># \u67f1\u72b6\u56fe\ndata = [12,34,23,54]\nlabels = [&#039;Jan&#039;,&#039;Fed&#039;,&#039;Mar&#039;,&#039;Apr&#039;]\nplt.xticks([0,1,2,3],labels)  # \u8bbe\u7f6ex\u8f74\u523b\u5ea6\nplt.bar([0,1,2,3],data)    \n<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u67f1\u72b6\u56fe.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u67f1\u72b6\u56fe.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<pre><code class=\"language-python\"># \u6a2a\u5411\u67f1\u72b6\u56fe\ndata = [12,34,23,54]\nlabels = [&#039;Jan&#039;,&#039;Fed&#039;,&#039;Mar&#039;,&#039;Apr&#039;]\nplt.yticks([0,1,2,3],labels)\nplt.barh([0,1,2,3],data)    \n<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u6a2a\u5411\u67f1\u72b6\u56fe.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u6a2a\u5411\u67f1\u72b6\u56fe.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<pre><code class=\"language-python\"># DataFrame\u6570\u7ec4\u56fe\ndf = pd.DataFrame({\n    &#039;Jan&#039;:pd.Series([1,2,3],index=[&#039;a&#039;,&#039;b&#039;,&#039;c&#039;]),\n    &#039;Fed&#039;:pd.Series([4,5,6],index=[&#039;b&#039;,&#039;a&#039;,&#039;c&#039;]),\n    &#039;Mar&#039;:pd.Series([7,8,9],index=[&#039;b&#039;,&#039;a&#039;,&#039;c&#039;]),\n    &#039;Apr&#039;:pd.Series([2,4,6],index=[&#039;b&#039;,&#039;a&#039;,&#039;c&#039;])\n})\n\ndf.plot.bar()  # \u6c34\u5e73\u67f1\u72b6\u56fe\uff0c\u5c06\u6bcf\u4e00\u884c\u4e2d\u7684\u503c\u5206\u7ec4\u5230\u5e76\u6392\u7684\u67f1\u5b50\u4e2d\u7684\u4e00\u7ec4\ndf.plot.barh(stacked=True,alpha=0.5)  # \u6a2a\u5411\u67f1\u72b6\u56fe\uff0c\u5c06\u6bcf\u4e00\u884c\u7684\u503c\u5806\u79ef\u5230\u4e00\u8d77\n<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u6570\u7ec4\u56fe.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u6570\u7ec4\u56fe.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<h3>2.3.2\u3001\u997c\u56fe<\/h3>\n<p>\u997c\u56fe\u7528\u4e8e\u8868\u793a\u4e0d\u540c\u7c7b\u522b\u7684\u5360\u6bd4\u60c5\u51b5\uff0c\u901a\u8fc7\u5f27\u5ea6\u5927\u5c0f\u6765\u5bf9\u6bd4\u5404\u79cd\u7c7b\u522b\u3002\u997c\u56fe\u5c06\u4e00\u4e2a\u5706\u997c\u6309\u7167\u7c7b\u522b\u7684\u5360\u6bd4\u5212\u5206\u6210\u591a\u4e2a\u533a\u5757\uff0c\u6574\u4e2a\u5706\u997c\u4ee3\u8868\u6570\u636e\u7684\u603b\u91cf\uff0c\u6bcf\u4e2a\u533a\u5757\u8868\u793a\u8be5\u5206\u7c7b\u5360\u603b\u4f53\u7684\u6bd4\u4f8b\u5927\u5c0f\u3002\u997c\u56fe\u53ef\u4ee5\u6bd4\u8f83\u6e05\u695a\u5730\u53cd\u6620\u51fa\u90e8\u5206\u4e0e\u90e8\u5206\u3001\u90e8\u5206\u4e0e\u6574\u4f53\u4e4b\u95f4\u7684\u6bd4\u4f8b\u5173\u7cfb\uff0c\u6613\u4e8e\u6bd4\u4f8b\u6bcf\u4e2a\u7c7b\u522b\u76f8\u5bf9\u4e8e\u603b\u6570\u7684\u5927\u5c0f\u3002\u4f46\u5728\u5bf9\u4e8e\u9762\u79ef\u5927\u5c0f\u7684\u4e0d\u654f\u611f\u7684\u60c5\u51b5\u4e0b\u6548\u679c\u4e0d\u662f\u5f88\u597d\u3002<\/p>\n<pre><code class=\"language-python\"># \u997c\u56fe\nplt.pie([10,20,30,40],labels=list(&#039;abcd&#039;),autopct=&quot;%.2f%%&quot;,explode=[0.1,0,0,0])  # \u997c\u56fe\nplt.axis(&quot;equal&quot;)\nplt.show()\n<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u997c\u56fe.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u997c\u56fe.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<h3>2.3.3\u3001\u6563\u70b9\u56fe<\/h3>\n<p>\u5bf9\u4e8e\u4e8c\u7ef4\u7ed8\u56fe\uff0c\u7ebf\u56fe\u548c\u70b9\u56fe\u53ef\u80fd\u662f\u91d1\u878d\u5b66\u4e2d\u7684\u6700\u91cd\u8981\u7684\uff0c\u521a\u624d\u5728\u4e0a\u9762\u7ebf\u56fe\u5df2\u7ecf\u6709\u8fc7\u7b80\u5355\u63a5\u89e6\uff0c\u63a5\u4e0b\u6765\u4e3b\u8981\u4ecb\u7ecd\u7684\u5c31\u662f\u70b9\u56fe\u4e86\uff0c\u8fd9\u79cd\u56fe\u8868\u7c7b\u578b\u53ef\u7528\u4e8e\u7ed8\u5236\u4e00\u4e2a\u91d1\u878d\u65f6\u95f4\u5e8f\u5217\u7684\u6536\u76ca\u548c\u53e6\u4e00\u4e2a\u65f6\u95f4\u5e8f\u5217\u6536\u76ca\u7684\u5bf9\u6bd4\u3002<\/p>\n<p>\u6563\u70b9\u56fe\u53c8\u79f0\u4e3a\u6563\u70b9\u5206\u5e03\u56fe\uff0c\u662f\u5229\u7528\u5750\u6807\u70b9\uff08\u6563\u70b9\uff09\u7684\u5206\u5e03\u5f62\u6001\u53cd\u6620\u7279\u5f81\u95f4\u7684\u76f8\u5173\u5173\u7cfb\u7684\u4e00\u79cd\u56fe\u5f62\u3002\u5b9e\u9645\u4e2d\u4e00\u822c\u4f7f\u7528\u4e8c\u7ef4\u6563\u70b9\u56fe\uff0c\u901a\u8fc7\u6563\u70b9\u7684\u758f\u5bc6\u7a0b\u5ea6\u548c\u53d8\u5316\u8d8b\u52bf\u8868\u793a\u4e24\u4e2a\u7279\u5f81\u4e4b\u95f4\u7684\u5173\u7cfb\u3002<\/p>\n<p>\u4e3b\u8981\u6709\u4ee5\u4e0b\u4e09\u4e2a\u7279\u70b9\uff1a<\/p>\n<p>1\uff09\u8868\u73b0\u7279\u5f81\u4e4b\u95f4\u662f\u5426\u5b58\u5728\u6570\u503c\u6216\u8005\u6570\u91cf\u7684\u5173\u8054\u8d8b\u52bf\uff0c\u5173\u8054\u8d8b\u52bf\u662f\u7ebf\u6027\u7684\u8fd8\u662f\u975e\u7ebf\u6027\u7684\u3002<\/p>\n<p>2\uff09\u51f8\u663e\u51fa\u79bb\u7fa4\u70b9\uff08\u5f02\u5e38\u70b9\uff09\u53ca\u5176\u5bf9\u6574\u4f53\u7684\u5f71\u54cd<\/p>\n<p>3\uff09\u6570\u636e\u91cf\u8d8a\u5927\u80fd\u53d1\u6325\u7684\u4f5c\u7528\u8d8a\u597d\u3002<\/p>\n<p>\u57fa\u672c\u8bed\u6cd5\u683c\u5f0f\uff1a<\/p>\n<pre><code class=\"language-python\">matplotlib.pyplot.scatter(x,y,s=None,c=None,marker=None,cmap=None,norm=None,vmin=None,\n    vmax=None,alpha=None,linewidths=None,verts=None,edgecolors=None,*,data=None,**kwargs,\n)\n<\/code><\/pre>\n<p>\u51fd\u6570\u53c2\u6570\u76f8\u5173\u8bf4\u660e\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u53c2\u6570\u540d\u79f0<\/th>\n<th style=\"text-align: center;\">\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">x,y<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536array\uff0c\u8868\u793ax\u8f74\u548cy\u8f74\u5bf9\u5e94\u7684\u00b7\u6570\u636e\u3002\u65e0\u9ed8\u8ba4\u503c<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">s<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536\u6570\u503c\u6216\u8005\u4e00\u7ef4array\uff0c\u6307\u5b9a\u70b9\u7684\u5927\u5c0f\uff0c\u4e00\u7ef4array\u8868\u793a\u6bcf\u4e2a\u70b9\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u4e3aNone<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">c<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536\u989c\u8272\u6216\u8005\u4e00\u5806array\uff0c\u6307\u5b9a\u70b9\u7684\u989c\u8272\uff0c\u4e00\u7ef4array\u8868\u793a\u6bcf\u4e2a\u70b9\u7684\u989c\u8272\u3002\u9ed8\u8ba4\u4e3aNone<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">marker<\/td>\n<td style=\"text-align: center;\">\u63a5\u6536\u7279\u5b9astr\uff0c\u8868\u793a\u7ed8\u5236\u7684\u70b9\u7684\u5f62\u72b6\u3002\u9ed8\u8ba4\u4e3aNone<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">alpha<\/td>\n<td style=\"text-align: center;\">\u63a5\u65360\uff5e1\u7684\u5c0f\u6570\uff0c\u8868\u793a\u70b9\u7684\u900f\u660e\u5ea6\u3002\u9ed8\u8ba4\u4e3aNone<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre><code class=\"language-python\">y = np.random.standard_normal((1000,2))  # \u751f\u6210\u6b63\u6001\u5206\u5e03\u7684\u4e8c\u7ef4\u968f\u673a\u6570\u7ec4\nc = np.random.randint(0,10,len(y))\n\nplt.figure(figsize=(7,5))\nplt.scatter(y[:,0],y[:,1],c=c,marker=&#039;o&#039;)  # \u901a\u8fc7scatter\u51fd\u6570\u52a0\u5165\u7b2c\u4e09\u7ef4\u6570\u636e\nplt.colorbar()  # \u901a\u8fc7\u5f69\u6761\u5bf9\u4e0d\u7528\u6f14\u793a\u6570\u636e\u8fdb\u884c\u63cf\u8ff0\nplt.grid(True)\nplt.xlabel(&#039;1st&#039;)\nplt.ylabel(&#039;2nd&#039;)\nplt.title(&quot;test5&quot;)\n<\/code><\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/test5.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/test5.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<h3>2.3.4\u3001\u76f4\u65b9\u56fe<\/h3>\n<pre><code class=\"language-python\">plt.figure(figsize=(7,4))\nplt.hist(y,label=[&#039;1st&#039;,&#039;2nd&#039;],bins=25)\nplt.grid(True)  # \u7f51\u683c\u8bbe\u7f6e\nplt.legend(loc=0)  # \u56fe\u4f8b\u6807\u7b7e\u4f4d\u7f6e\u8bbe\u7f6e\nplt.axis(&quot;tight&quot;)\nplt.xlabel(&#039;index&#039;)\nplt.ylabel(&#039;frequency&#039;)\nplt.title(&quot;test6&quot;)\n<\/code><\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/test6.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/test6.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<p>\u76f4\u65b9\u56fe\u662f\u91d1\u878d\u5e94\u7528\u5f53\u4e2d\u6bd4\u8f83\u5e38\u7528\u7684\u56fe\u8868\u7c7b\u578b\uff0c\u63a5\u4e0b\u6765\u4e3b\u8981\u4ecb\u7ecd\u4e00\u4e0bplt.hist\u7684\u4f7f\u7528\u65b9\u6cd5\u4ee5\u53ca\u5b83\u7684\u53c2\u6570\u8bf4\u660e                                                                                                                                                                                                                                                                                                                                                                                    <\/p>\n<pre><code class=\"language-python\">plt.hist(\n    [&#039;x&#039;, &#039;bins=None&#039;, &#039;range=None&#039;, &#039;density=None&#039;, &#039;weights=None&#039;, &#039;cumulative=False&#039;, &#039;bottom=None&#039;, &quot;histtype=&#039;bar&#039;&quot;, &quot;align=&#039;mid&#039;&quot;, &quot;orientation=&#039;vertical&#039;&quot;, &#039;rwidth=None&#039;, &#039;log=False&#039;, &#039;color=None&#039;, &#039;label=None&#039;, &#039;stacked=False&#039;, &#039;normed=None&#039;, &#039;*&#039;, &#039;data=None&#039;, &#039;**kwargs&#039;],\n)\n<\/code><\/pre>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u53c2\u6570<\/th>\n<th style=\"text-align: center;\">\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">x<\/td>\n<td style=\"text-align: center;\">\u5217\u8868\u5bf9\u8c61\uff0cndarray\u5bf9\u8c61<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">bins<\/td>\n<td style=\"text-align: center;\">\u6570\u636e\u7ec4\uff08bin\uff09\u6570<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">range<\/td>\n<td style=\"text-align: center;\">\u6570\u636e\u7ec4\u7684\u4e0a\u754c\u548c\u4e0b\u754c<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">normed<\/td>\n<td style=\"text-align: center;\">\u89c4\u8303\u5316\u4e3a\u6574\u65701<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">weights<\/td>\n<td style=\"text-align: center;\">x\u8f74\u4e0a\u6bcf\u4e2a\u503c\u7684\u6743\u91cd<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">cumulative<\/td>\n<td style=\"text-align: center;\">\u6bcf\u4e2a\u6570\u636e\u7ec4\u5305\u542b\u8f83\u4f4e\u7ec4\u522b\u7684\u8ba1\u6570<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">histtype<\/td>\n<td style=\"text-align: center;\">\u9009\u9879\uff1abar,barstacked,step,stepfilled<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">align<\/td>\n<td style=\"text-align: center;\">\u9009\u9879\uff1aleft,mid,right<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">orientation<\/td>\n<td style=\"text-align: center;\">\u9009\u9879:horizontal,vertical<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">rwidth<\/td>\n<td style=\"text-align: center;\">\u6761\u5757\u7684\u76f8\u5bf9\u5bbd\u5ea6<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">log<\/td>\n<td style=\"text-align: center;\">\u5bf9\u6570\u523b\u5ea6<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">color<\/td>\n<td style=\"text-align: center;\">\u6bcf\u4e2a\u6570\u636e\u96c6\u7684\u989c\u8272<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">label<\/td>\n<td style=\"text-align: center;\">\u6807\u7b7e\u6240\u7528\u7684\u5b57\u7b26\u4e32\u6216\u8005\u5b57\u7b26\u4e32\u5e8f\u5217<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">stacked<\/td>\n<td style=\"text-align: center;\">\u5806\u53e0\u591a\u4e2a\u6570\u636e\u96c6<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>2.3.5\u3001\u7bb1\u578b\u56fe<\/h3>\n<p>\u7bb1\u578b\u56fe\u53ef\u4ee5\u7b80\u6d01\u5730\u6982\u8ff0\u6570\u636e\u96c6\u7684\u7279\u6027\uff0c\u53ef\u4ee5\u5f88\u5bb9\u6613\u7684\u6bd4\u8f83\u591a\u4e2a\u6570\u636e\u96c6\u3002<\/p>\n<pre><code class=\"language-python\">fig,ax = plt.subplots(figsize=(7,4))\nplt.boxplot(y)\nplt.grid(True)\nplt.setp(ax,xticklabels=[&#039;1st&#039;,&#039;2nd&#039;])\nplt.xlabel(&#039;data set&#039;)\nplt.ylabel(&quot;value&quot;)\nplt.title(&quot;test7&quot;)\n<\/code><\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/test7.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/test7.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<h3>2.3.6\u3001\u8865\u5145\uff1a\u7ed8\u5236\u6570\u5b66\u51fd\u6570<\/h3>\n<p>\u4ee5\u56fe\u5f62\u7684\u65b9\u5f0f\u8bf4\u660e\u67d0\u4e2a\u4e0b\u9650\u548c\u4e0a\u9650\u4e4b\u95f4\u51fd\u6570\u56fe\u50cf\u4e0b\u65b9\u533a\u57df\u7684\u9762\u79ef\uff0c\u7b80\u800c\u8a00\u4e4b\u5c31\u662f\uff0c\u4ece\u4e0b\u9650\u5230\u4e0a\u9650\u4e4b\u95f4\u51fd\u6570\u79ef\u5206\u503c<\/p>\n<pre><code class=\"language-python\"># \u7b2c\u4e00\u6b65\uff1a\u5b9a\u4e49\u6c42\u53d6\u79ef\u5206\u7684\u51fd\u6570\ndef func(x):\n    return 0.5 * np.exp(x) + 1   # \u6307\u6570\u51fd\u6570\n\n# \u7b2c\u4e8c\u6b65\uff1a\u5b9a\u4e49\u79ef\u5206\u533a\u95f4\uff0c\u751f\u6210\u5fc5\u987b\u5f97\u6570\u503c\na, b = 0.5 , 1.5\nx = np.linspace(0,2)\ny = func(x)\n\n# \u7b2c\u4e09\u6b65\uff1a\u7ed8\u5236\u51fd\u6570\u56fe\u50cf\nfig, ax = plt.subplots(figsize=(7,5))\nplt.plot(x,y,&#039;b&#039;,linewidth=2)\nplt.ylim(ymin=0)\n\n# \u7b2c\u56db\u6b65\uff1a\u4f7f\u7528Polygon\u51fd\u6570\u751f\u6210\u9634\u5f71\u90e8\u5206\uff0c\u8868\u793a\u79ef\u5206\u9762\u79ef\nIx = np.linspace(a, b)\nIy = func(Ix)\nverts = [(a,0)] + list(zip(Ix, Iy)) + [(b, 0)]\npoly = plt.Polygon(verts,facecolor=&#039;0.7&#039;,edgecolor=&#039;0.5&#039;)\nax.add_patch(poly)\n\n# \u7b2c\u4e94\u6b65\uff1a\u4f7f\u7528plt.text\u548cplt.figtext\u5728\u56fe\u8868\u4e0a\u6dfb\u52a0\u6570\u5b66\u516c\u5f0f\u548c\u4e00\u4e9b\u5750\u6807\u8f74\u6807\u7b7e\nplt.text(0.5 * (a + b),1,r&quot;$\\int_a^b f(x)\\mathrm{d}x$&quot;,horizontalalignment=&#039;center&#039;,fontsize=20)\nplt.figtext(0.9, 0.075, &quot;$x$&quot;)\nplt.figtext(0.075,0.9,&quot;$f(x)$&quot;)\n\n# \u7b2c\u516d\u6b65\uff1a\u8bbe\u7f6e\u523b\u5ea6\u6807\u7b7e\u4ee5\u53ca\u6dfb\u52a0\u7f51\u683c\nax.set_xticks((a, b))\nax.set_xticklabels((&#039;$a$&#039;, &#039;$b$&#039;))\nax.set_yticks([func(a), func(b)])\nax.set_yticklabels((&#039;$f(a)$&#039;, &#039;$f(b)$&#039;))\nplt.grid(True)\n<\/code><\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u6570\u5b66\u51fd\u6570.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u6570\u5b66\u51fd\u6570.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><br \/>\n$$<br \/>\n\\int_a^bf(x)dx<br \/>\n$$<\/p>\n<h1>3\u3001\u91d1\u878d\u5b66\u56fe\u8868<\/h1>\n<h2>3.1\u3001\u70db\u67f1\u56fe<\/h2>\n<p>\u4ee5\u4e0a\u7ed8\u5236\u51fa\u6765\u7684\u6570\u636e\u90fd\u662f\u4e00\u4e9b\u5e38\u7528\u7684\u6570\u636e\u56fe\u50cf\uff0c\u4f46\u662f\u5728\u91d1\u878d\u884c\u4e1a\u4f1a\u6709\u4e00\u4e9b\u72ec\u6709\u7684\u56fe\u50cf\uff0c\u4e4b\u524d\u5728matplotlib\u5f53\u4e2d\u8fd8\u63d0\u4f9b\u4e86\u5c11\u91cf\u7684\u7279\u6b8a\u91d1\u878d\u56fe\u8868\uff0c\u8fd9\u4e9b\u56fe\u8868\uff0c\u5c31\u4f8b\u5982\u70db\u67f1\u56fe\uff0c\u4e3b\u8981\u662f\u7528\u4e8e\u53ef\u89c6\u5316\u5386\u53f2\u80a1\u4ef7\u6570\u636e\u6216\u8005\u7c7b\u4f3c\u7684\u91d1\u878d\u65f6\u95f4\u5e8f\u5217\u3002<\/p>\n<p>\u73b0\u5728\u8fd9\u4e2a\u65b9\u6cd5\u5df2\u7ecf\u72ec\u7acb\u51fa\u6765\u81ea\u6210\u4e00\u4e2a\u6a21\u5757\u4e86<em><code>mpl_finance<\/code><\/em><\/p>\n<p>anaconda\u4e2dmpl_finance\u5b89\u88c5\u65b9\u5f0f\uff1a<\/p>\n<p>\u5c06<a href=\"http:\/\/jump.bdimg.com\/safecheck\/index?url=rN3wPs8te\/r8jfr8YhogjfUWFoMgIRa8DaWj5IFI7jB6TkQw42zce5RaIoYlO2yf2FD\/58WVz7f\/7MMdoKxjlhcy1SkdO1XJy3ST3QjZSi6e7pqerS8PFNTZZM1XyoDafm3alHHRoE0MyOc\/xXFrwYQkmFrsLRsabLbzxSQM0Rs0OWbz6YBdTVX3ZMCahZXTMDxm7iZ2BjQ=\">https:\/\/github.com\/matplotlib\/mpl_finance\/archive\/master.zip<\/a>\u4e0b\u8f7d\u5230\u672c\u5730<\/p>\n<p>\u5728anaconda\u73af\u5883\u4e2d\u8fd0\u884c\u547d\u4ee4\uff1a<em><code>pip install \u672c\u5730\u8def\u5f84\/mpl_finance-master.zip<\/code><\/em><\/p>\n<p>\u8c03\u7528\u65b9\u5f0f\uff1a<\/p>\n<blockquote>\n<p>import mpl_finance as mpf<\/p>\n<\/blockquote>\n<pre><code class=\"language-python\">import matplotlib.pyplot as plt\nimport mpl_finance as mpf\nimport tushare as ts\nimport pandas as pd\nfrom matplotlib.pylab import date2num\nfrom dateutil.parser import parse\nimport numpy as np\nimport matplotlib.dates as mdate\n\ndata = ts.get_k_data(&#039;000001&#039;)  # \u83b7\u53d6\u5e73\u5b89\u7684k\u7ebf\u6570\u636e\ndata_of = data[:60]  # \u53ea\u53d6\u524d60\u4efd\u6570\u636e\n\nfig, ax = plt.subplots(figsize=(15, 7))\n__colorup__ = &quot;r&quot;\n__colordown__ = &quot;g&quot;\n\n# \u56fe\u8868\u663e\u793a\u4e2d\u6587\nplt.rcParams[&#039;font.family&#039;] = [&#039;sans-serif&#039;]\nplt.rcParams[&#039;font.sans-serif&#039;] = [&#039;SimHei&#039;]\n\nqutotes = []\nfor index, (d, o, c, h, l) in enumerate(\n        zip(data_of.date, data_of.open, data_of.close,\n            data_of.high, data_of.low)):\n\n    # \u65f6\u95f4\u9700\u8981\u901a\u8fc7date2num\u8f6c\u6362\u4e3a\u6d6e\u70b9\u578b\n    d = date2num(parse(d))\n    # \u65e5\u671f\uff0c\u5f00\u76d8\uff0c\u6536\u76d8\uff0c\u6700\u9ad8\uff0c\u6700\u4f4e\u7ec4\u6210tuple\u5bf9\u8c61val\n    val = (d, o, c, h, l)\n    # \u52a0val\u52a0\u5165qutotes\n    qutotes.append(val)\n\n# \u4f7f\u7528mpf.candlestick_ochl\u8fdb\u884c\u8721\u70db\u7ed8\u5236\uff0cochl\u4ee3\u8868\uff1aopen\uff0cclose\uff0chigh\uff0clow\nmpf.candlestick_ochl(ax, qutotes, width=0.8, colorup=__colorup__,colordown=__colordown__)\n\n#\u8bbe\u7f6ex\u8f74\u4e3a\u65f6\u95f4\u683c\u5f0f\uff0c\u5426\u5219x\u8f74\u663e\u793a\u7684\u5c06\u662f\u7c7b\u4f3c\u4e8e\u2018736268\u2019\u8fd9\u6837\u7684\u8f6c\u7801\u540e\u7684\u6570\u5b57\u683c\u5f0f\nax.xaxis.set_major_formatter(mdate.DateFormatter(&#039;%Y-%m-%d&#039;))\n\nplt.xticks(pd.date_range(&#039;2016-08-01&#039;,&#039;2016-11-30&#039;,freq=&#039;W&#039;),rotation=60)\nplt.grid(True)  # \u7f51\u683c\u8bbe\u7f6e\nplt.title(&quot;k\u7ebf\u56fe&quot;)\nax.autoscale_view()\nax.xaxis_date()\n<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/K\u7ebf\u56fe.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/K\u7ebf\u56fe.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<h2>3.2\u30013D\u7ed8\u56fe<\/h2>\n<p>\u5bf9\u4e8e\u91d1\u878d\u884c\u4e1a\u6765\u8bf4\uff0c\u7528\u4e0a3D\u7ed8\u56fe\u7684\u573a\u666f\u5e76\u4e0d\u662f\u5f88\u591a\uff0c\u4f46\u662f\u6709\u4e00\u4e2a\u6ce2\u52a8\u7387\u5e73\u9762\u8fd8\u662f\u9700\u8981\u7b80\u5355\u4ecb\u7ecd\u4e00\u4e0b\uff0c\u5b83\u53ef\u4ee5\u540c\u65f6\u5c55\u793a\u8bb8\u591a\u5230\u671f\u65e5\u548c\u884c\u6743\u4ef7\u7684\u9690\u542b\u6ce2\u52a8\u7387\uff0c\u63a5\u4e0b\u6765\u624b\u52a8\u751f\u6210\u4e00\u4e2a\u865a\u62df\u7684\u7c7b\u4f3c\u6ce2\u52a8\u7387\u5e73\u9762\u7684\u56fe\u8868\uff1a<\/p>\n<pre><code class=\"language-python\"># \u6839\u636e\u4e24\u4e2a1\u7ef4ndarray\u5bf9\u8c61\u8f6c\u6362\u4e3a\u4e00\u4e2a\u4e8c\u7ef4\u6570\u7ec4\nstrike = np.linspace(50,150,24)\nttm = np.linspace(0.5,2.5,24)\nstrike,ttm = np.meshgrid(strike,ttm)\n\n# \u4ea7\u751f\u4e00\u7ec4\u865a\u5047\u7684\u9690\u542b\u6ce2\u52a8\u7387\niv = (strike - 100) ** 2\/ (100 * strike) \/ ttm\n\n# \u751f\u6210\u6ce2\u52a8\u7387\u56fe\u8868\nfig = plt.figure(figsize=(9,6))\nax = fig.gca(projection=&#039;3d&#039;)\nsurf = ax.plot_surface(strike, ttm, iv, rstride=2, cstride=2, cmap=plt.cm.coolwarm, linewidth=0.5, antialiased=True)\nax.set_xlabel(&#039;strike&#039;)\nax.set_ylabel(&#039;time_to_maturity&#039;)\nax.set_zlabel(&#039;implied volatility&#039;)\nfig.colorbar(surf,shrink=0.5,aspect=5)\n<\/code><\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u6ce2\u52a8\u7387\u56fe\u8868.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u6ce2\u52a8\u7387\u56fe\u8868.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<p>\u63a5\u4e0b\u6765\u4e3b\u8981\u4ecb\u7ecd\u4e00\u4e0b<em><code>plot_surface<\/code><\/em>\u51fd\u6570\u7684\u4e0d\u540c\u53c2\u6570<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u53c2\u6570<\/th>\n<th style=\"text-align: center;\">\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">X,Y,Z<\/td>\n<td style=\"text-align: center;\">2D\u6570\u7ec4\u5f62\u5f0f\u7684\u6570\u636e\u503c<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">rstride<\/td>\n<td style=\"text-align: center;\">\u6570\u7ec4\u884c\u8ddd\uff08\u6b65\u957f\u5927\u5c0f\uff09<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">cstride<\/td>\n<td style=\"text-align: center;\">\u6570\u7ec4\u5217\u8ddd\uff08\u6b65\u957f\u5927\u5c0f\uff09<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">color<\/td>\n<td style=\"text-align: center;\">\u66f2\u9762\u5757\u989c\u8272<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">cmap<\/td>\n<td style=\"text-align: center;\">\u66f2\u9762\u5757\u989c\u8272\u6620\u5c04<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">facecolors<\/td>\n<td style=\"text-align: center;\">\u5355\u72ec\u66f2\u9762\u5757\u8868\u9762\u989c\u8272<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">norm<\/td>\n<td style=\"text-align: center;\">\u5c06\u503c\u6620\u5c04\u4e3a\u989c\u8272\u7684Normalize\u5b9e\u4f8b<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">vmin<\/td>\n<td style=\"text-align: center;\">\u6620\u5c04\u7684\u6700\u5c0f\u503c<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">vmax<\/td>\n<td style=\"text-align: center;\">\u6620\u5c04\u7684\u6700\u5927\u503c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u8f6c\u6362\u89c6\u89d2<\/strong><\/p>\n<pre><code class=\"language-python\">fig = plt.figure(figsize=(8,5))\nax = fig.add_subplot(111, projection=&#039;3d&#039;)\nax.view_init(30, 60)  # \u901a\u8fc7view_init\u51fd\u6570\u8bbe\u7f6e\u4e0d\u540c\u7684\u89c6\u89d2\nax.scatter(strike, ttm, iv, zdir=&#039;z&#039;, s=25, c=&#039;b&#039;, marker=&#039;o&#039;)\n\nax.set_xlabel(&#039;strike&#039;)\nax.set_ylabel(&#039;time_to_maturity&#039;)\nax.set_zlabel(&#039;implied volatility&#039;)\n<\/code><\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u6ce2\u52a8\u73872.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u6ce2\u52a8\u73872.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<h1>4\u3001\u4fdd\u5b58\u56fe\u8868\u5230\u6587\u4ef6<\/h1>\n<blockquote>\n<p>plt.savafig(&#8216;\u6587\u4ef6\u540d.\u62d3\u5c55\u540d&#8217;)<\/p>\n<\/blockquote>\n<p>\u6587\u4ef6\u7c7b\u578b\u662f\u901a\u8fc7\u6587\u4ef6\u6269\u5c55\u540d\u63a8\u65ad\u51fa\u6765\u7684\u3002\u56e0\u6b64\uff0c\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f.pdf\uff0c\u5c31\u4f1a\u5f97\u5230\u4e00\u4e2aPDF\u6587\u4ef6\u3002<\/p>\n<pre><code class=\"language-python\">plt.savefig(&#039;123.pdf&#039;)\n<\/code><\/pre>\n<p>savefig\u5e76\u975e\u4e00\u5b9a\u8981\u5199\u5165\u78c1\u76d8\uff0c\u4e5f\u53ef\u4ee5\u5199\u5165\u4efb\u4f55\u6587\u4ef6\u578b\u7684\u5bf9\u8c61\uff0c\u6bd4\u5982BytesIO\uff1a<\/p>\n<pre><code class=\"language-python\">from io import BytesIO\nbuffer = BytesIO()\nplt.savefig(buffer)\nplot_data = buffer.getvalue()\n<\/code><\/pre>\n<table>\n<thead>\n<tr>\n<th>\u53c2\u6570<\/th>\n<th style=\"text-align: center;\">\u8bf4\u660e<\/th>\n<th><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>fname<\/td>\n<td style=\"text-align: center;\">\u542b\u6709\u6587\u4ef6\u8def\u5f84\u7684\u5b57\u7b26\u4e32\u6216\u8005Python\u7684\u6587\u4ef6\u578b\u5bf9\u8c61\u3002<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>dpi<\/td>\n<td style=\"text-align: center;\">\u56fe\u50cf\u5206\u8fa8\u7387\uff0c\u9ed8\u8ba4\u4e3a100<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>format<\/td>\n<td style=\"text-align: center;\">\u663e\u793a\u8bbe\u7f6e\u6587\u4ef6\u683c\u5f0f(&quot;png&quot;,&quot;jpg&quot;,&quot;pdf&quot;,&quot;svg&quot;,&quot;ps&quot;,&#8230;)<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>facecolor\u3001edgecolor<\/td>\n<td style=\"text-align: center;\">\u80cc\u666f\u8272\uff0c\u9ed8\u8ba4\u4e3a&quot;W&quot;(\u767d\u8272)<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>bbox_inches<\/td>\n<td style=\"text-align: center;\">\u56fe\u8868\u9700\u8981\u4fdd\u5b58\u7684\u90e8\u5206\u3002\u8bbe\u7f6e\u4e3a\u201dtight\u201c\uff0c\u5219\u5c1d\u8bd5\u526a\u9664\u56fe\u8868\u5468\u56f4\u7a7a\u767d\u90e8\u5206<\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul>\n<li><a href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/bokeh\/bokeh\">Bokeh<\/a> &#8211; Python\u7684\u4ea4\u4e92\u5f0f\u7f51\u7edc\u7ed8\u56fe.<\/li>\n<li><a href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/mwaskom\/seaborn\">Seaborn<\/a> &#8211; \u4f7f\u7528Matplotlib\u7684\u7edf\u8ba1\u6570\u636e\u53ef\u89c6\u5316.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u4ec0\u4e48\u662f\u6570\u636e\u53ef\u89c6\u5316 Matplotlib\u7684\u7528\u6cd5 \u91d1\u878d\u5b66\u56fe\u8868 \u4fdd\u5b58\u56fe\u8868 1\u3001\u4ec0\u4e48\u662f\u6570\u636e\u53ef\u89c6\u5316 \u200b \u6570\u636e\u53ef\u89c6\u5316\u5728\u91cf\u5316 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[315,310],"tags":[],"_links":{"self":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/3670"}],"collection":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3670"}],"version-history":[{"count":0,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/3670\/revisions"}],"wp:attachment":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3670"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3670"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3670"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}