{"id":946615,"date":"2024-12-26T23:44:09","date_gmt":"2024-12-26T15:44:09","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/946615.html"},"modified":"2024-12-26T23:44:11","modified_gmt":"2024-12-26T15:44:11","slug":"python%e5%a6%82%e4%bd%95%e5%87%ba%e5%9b%be","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/946615.html","title":{"rendered":"python\u5982\u4f55\u51fa\u56fe"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25082721\/2d85dc62-f246-4eb7-a230-bce8c2628b0e.webp\" alt=\"python\u5982\u4f55\u51fa\u56fe\" \/><\/p>\n<p><p> <strong>\u5728Python\u4e2d\uff0c\u7ed8\u5236\u56fe\u8868\u7684\u5e38\u7528\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528Matplotlib\u3001Seaborn\u548cPlotly\u7b49\u5e93\u3002Matplotlib\u662f\u6700\u57fa\u672c\u3001\u6700\u5e7f\u6cdb\u4f7f\u7528\u7684\u5e93\uff0cSeaborn\u63d0\u4f9b\u4e86\u66f4\u9ad8\u7ea7\u548c\u7f8e\u89c2\u7684\u7edf\u8ba1\u56fe\u5f62\uff0cPlotly\u5219\u7528\u4e8e\u4ea4\u4e92\u5f0f\u56fe\u8868\u3002<\/strong>\u4e0b\u9762\u6211\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528Matplotlib\u5e93\u8fdb\u884c\u7ed8\u56fe\uff0c\u5e76\u4e14\u4f1a\u7b80\u5355\u4ecb\u7ecdSeaborn\u548cPlotly\u7684\u7528\u6cd5\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001MATPLOTLIB\u5e93<\/p>\n<\/p>\n<p><p>Matplotlib\u662fPython\u4e2d\u6700\u5e38\u7528\u7684\u7ed8\u56fe\u5e93\u4e4b\u4e00\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u7ed8\u56fe\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><h3>1.1\u3001\u5b89\u88c5Matplotlib<\/h3>\n<\/p>\n<p><p>\u8981\u4f7f\u7528Matplotlib\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5\u8be5\u5e93\u3002\u53ef\u4ee5\u901a\u8fc7pip\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install matplotlib<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>1.2\u3001Matplotlib\u57fa\u672c\u7ed8\u56fe<\/h3>\n<\/p>\n<p><p>Matplotlib\u7684\u6838\u5fc3\u5bf9\u8c61\u662ffigure\u548caxes\u3002figure\u662f\u4e00\u4e2a\u56fe\u5f62\u7a97\u53e3\uff0c\u53ef\u4ee5\u5305\u542b\u591a\u4e2aaxes\uff08\u5373\u5b50\u56fe\uff09\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<h2><strong>\u521b\u5efa\u6570\u636e<\/strong><\/h2>\n<p>x = [1, 2, 3, 4, 5]<\/p>\n<p>y = [2, 3, 5, 7, 11]<\/p>\n<h2><strong>\u521b\u5efa\u56fe\u5f62\u548c\u8f74<\/strong><\/h2>\n<p>fig, ax = plt.subplots()<\/p>\n<h2><strong>\u7ed8\u5236\u7ebf\u56fe<\/strong><\/h2>\n<p>ax.plot(x, y)<\/p>\n<h2><strong>\u8bbe\u7f6e\u6807\u9898\u548c\u6807\u7b7e<\/strong><\/h2>\n<p>ax.set_title(&#39;Simple Plot&#39;)<\/p>\n<p>ax.set_xlabel(&#39;X-axis&#39;)<\/p>\n<p>ax.set_ylabel(&#39;Y-axis&#39;)<\/p>\n<h2><strong>\u663e\u793a\u56fe\u5f62<\/strong><\/h2>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u4e0a\u8ff0\u4ee3\u7801\u6f14\u793a\u4e86\u5982\u4f55\u4f7f\u7528Matplotlib\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u7ebf\u56fe\u3002<\/strong><\/p>\n<\/p>\n<p><h3>1.3\u3001Matplotlib\u9ad8\u7ea7\u7ed8\u56fe<\/h3>\n<\/p>\n<p><p>Matplotlib\u4e0d\u4ec5\u53ef\u4ee5\u7ed8\u5236\u7b80\u5355\u7684\u7ebf\u56fe\uff0c\u8fd8\u53ef\u4ee5\u7ed8\u5236\u5176\u4ed6\u7c7b\u578b\u7684\u56fe\u8868\uff0c\u5982\u67f1\u72b6\u56fe\u3001\u6563\u70b9\u56fe\u3001\u76f4\u65b9\u56fe\u7b49\u3002<\/p>\n<\/p>\n<p><h4>1.3.1\u3001\u7ed8\u5236\u67f1\u72b6\u56fe<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<h2><strong>\u521b\u5efa\u6570\u636e<\/strong><\/h2>\n<p>categories = [&#39;A&#39;, &#39;B&#39;, &#39;C&#39;, &#39;D&#39;]<\/p>\n<p>values = [10, 20, 15, 25]<\/p>\n<h2><strong>\u521b\u5efa\u56fe\u5f62\u548c\u8f74<\/strong><\/h2>\n<p>fig, ax = plt.subplots()<\/p>\n<h2><strong>\u7ed8\u5236\u67f1\u72b6\u56fe<\/strong><\/h2>\n<p>ax.bar(categories, values)<\/p>\n<h2><strong>\u8bbe\u7f6e\u6807\u9898\u548c\u6807\u7b7e<\/strong><\/h2>\n<p>ax.set_title(&#39;Bar Chart&#39;)<\/p>\n<p>ax.set_xlabel(&#39;Categories&#39;)<\/p>\n<p>ax.set_ylabel(&#39;Values&#39;)<\/p>\n<h2><strong>\u663e\u793a\u56fe\u5f62<\/strong><\/h2>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>1.3.2\u3001\u7ed8\u5236\u6563\u70b9\u56fe<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<h2><strong>\u521b\u5efa\u6570\u636e<\/strong><\/h2>\n<p>x = [1, 2, 3, 4, 5]<\/p>\n<p>y = [2, 3, 5, 7, 11]<\/p>\n<h2><strong>\u521b\u5efa\u56fe\u5f62\u548c\u8f74<\/strong><\/h2>\n<p>fig, ax = plt.subplots()<\/p>\n<h2><strong>\u7ed8\u5236\u6563\u70b9\u56fe<\/strong><\/h2>\n<p>ax.scatter(x, y)<\/p>\n<h2><strong>\u8bbe\u7f6e\u6807\u9898\u548c\u6807\u7b7e<\/strong><\/h2>\n<p>ax.set_title(&#39;Scatter Plot&#39;)<\/p>\n<p>ax.set_xlabel(&#39;X-axis&#39;)<\/p>\n<p>ax.set_ylabel(&#39;Y-axis&#39;)<\/p>\n<h2><strong>\u663e\u793a\u56fe\u5f62<\/strong><\/h2>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>1.4\u3001Matplotlib\u7684\u81ea\u5b9a\u4e49<\/h3>\n<\/p>\n<p><p>Matplotlib\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u81ea\u5b9a\u4e49\u9009\u9879\uff0c\u53ef\u4ee5\u6539\u53d8\u56fe\u5f62\u7684\u5916\u89c2\u3001\u989c\u8272\u3001\u6837\u5f0f\u7b49\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u7684\u81ea\u5b9a\u4e49\u6280\u5de7\u3002<\/p>\n<\/p>\n<p><h4>1.4.1\u3001\u8bbe\u7f6e\u989c\u8272\u548c\u6837\u5f0f<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u901a\u8fc7\u53c2\u6570\u6765\u8bbe\u7f6e\u7ebf\u7684\u989c\u8272\u548c\u6837\u5f0f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">ax.plot(x, y, color=&#39;red&#39;, linestyle=&#39;--&#39;, marker=&#39;o&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>1.4.2\u3001\u6dfb\u52a0\u7f51\u683c\u548c\u56fe\u4f8b<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">ax.grid(True)<\/p>\n<p>ax.legend([&#39;Data&#39;])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>1.4.3\u3001\u8bbe\u7f6e\u5750\u6807\u8f74\u8303\u56f4<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">ax.set_xlim(0, 6)<\/p>\n<p>ax.set_ylim(0, 12)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e8c\u3001SEABORN\u5e93<\/p>\n<\/p>\n<p><p>Seaborn\u662f\u57fa\u4e8eMatplotlib\u6784\u5efa\u7684\u9ad8\u7ea7\u7ed8\u56fe\u5e93\uff0c\u4e3b\u8981\u7528\u4e8e\u7edf\u8ba1\u56fe\u5f62\u7684\u7ed8\u5236\u3002<\/p>\n<\/p>\n<p><h3>2.1\u3001\u5b89\u88c5Seaborn<\/h3>\n<\/p>\n<p><p>\u540c\u6837\u53ef\u4ee5\u901a\u8fc7pip\u547d\u4ee4\u5b89\u88c5Seaborn\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install seaborn<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2.2\u3001Seaborn\u57fa\u672c\u7ed8\u56fe<\/h3>\n<\/p>\n<p><p>Seaborn\u63d0\u4f9b\u4e86\u66f4\u4e3a\u7b80\u6d01\u7684API\uff0c\u53ef\u4ee5\u8f7b\u677e\u7ed8\u5236\u7edf\u8ba1\u56fe\u5f62\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import seaborn as sns<\/p>\n<p>import matplotlib.pyplot as plt<\/p>\n<h2><strong>\u52a0\u8f7d\u793a\u4f8b\u6570\u636e\u96c6<\/strong><\/h2>\n<p>tips = sns.load_dataset(&quot;tips&quot;)<\/p>\n<h2><strong>\u7ed8\u5236\u7bb1\u7ebf\u56fe<\/strong><\/h2>\n<p>sns.boxplot(x=&quot;day&quot;, y=&quot;total_bill&quot;, data=tips)<\/p>\n<h2><strong>\u663e\u793a\u56fe\u5f62<\/strong><\/h2>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>Seaborn\u5728\u7ed8\u5236\u7edf\u8ba1\u56fe\u5f62\u65f6\u975e\u5e38\u65b9\u4fbf\uff0c\u4e14\u9ed8\u8ba4\u6837\u5f0f\u66f4\u52a0\u7f8e\u89c2\u3002<\/strong><\/p>\n<\/p>\n<p><h3>2.3\u3001Seaborn\u9ad8\u7ea7\u7ed8\u56fe<\/h3>\n<\/p>\n<p><p>Seaborn\u63d0\u4f9b\u4e86\u8bb8\u591a\u9ad8\u7ea7\u56fe\u5f62\u7ed8\u5236\u529f\u80fd\uff0c\u5982\u70ed\u529b\u56fe\u3001\u6210\u5bf9\u56fe\u7b49\u3002<\/p>\n<\/p>\n<p><h4>2.3.1\u3001\u7ed8\u5236\u70ed\u529b\u56fe<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import seaborn as sns<\/p>\n<p>import matplotlib.pyplot as plt<\/p>\n<h2><strong>\u521b\u5efa\u6570\u636e<\/strong><\/h2>\n<p>flights = sns.load_dataset(&quot;flights&quot;)<\/p>\n<p>flights_pivot = flights.pivot(&quot;month&quot;, &quot;year&quot;, &quot;passengers&quot;)<\/p>\n<h2><strong>\u7ed8\u5236\u70ed\u529b\u56fe<\/strong><\/h2>\n<p>sns.heatmap(flights_pivot, annot=True, fmt=&quot;d&quot;)<\/p>\n<h2><strong>\u663e\u793a\u56fe\u5f62<\/strong><\/h2>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2.3.2\u3001\u7ed8\u5236\u6210\u5bf9\u56fe<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import seaborn as sns<\/p>\n<p>import matplotlib.pyplot as plt<\/p>\n<h2><strong>\u52a0\u8f7d\u793a\u4f8b\u6570\u636e\u96c6<\/strong><\/h2>\n<p>iris = sns.load_dataset(&quot;iris&quot;)<\/p>\n<h2><strong>\u7ed8\u5236\u6210\u5bf9\u56fe<\/strong><\/h2>\n<p>sns.p<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>rplot(iris, hue=&quot;species&quot;)<\/p>\n<h2><strong>\u663e\u793a\u56fe\u5f62<\/strong><\/h2>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e09\u3001PLOTLY\u5e93<\/p>\n<\/p>\n<p><p>Plotly\u662f\u4e00\u4e2a\u7528\u4e8e\u521b\u5efa\u4ea4\u4e92\u5f0f\u56fe\u8868\u7684\u5e93\uff0c\u53ef\u4ee5\u8f7b\u677e\u5728Web\u5e94\u7528\u4e2d\u5d4c\u5165\u548c\u5171\u4eab\u3002<\/p>\n<\/p>\n<p><h3>3.1\u3001\u5b89\u88c5Plotly<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u901a\u8fc7pip\u547d\u4ee4\u5b89\u88c5Plotly\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install plotly<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>3.2\u3001Plotly\u57fa\u672c\u7ed8\u56fe<\/h3>\n<\/p>\n<p><p>Plotly\u4f7f\u7528\u8d77\u6765\u4e5f\u5f88\u7b80\u5355\uff0c\u652f\u6301\u591a\u79cd\u7c7b\u578b\u7684\u4ea4\u4e92\u5f0f\u56fe\u8868\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import plotly.express as px<\/p>\n<h2><strong>\u521b\u5efa\u6570\u636e<\/strong><\/h2>\n<p>df = px.data.iris()<\/p>\n<h2><strong>\u7ed8\u5236\u4ea4\u4e92\u5f0f\u6563\u70b9\u56fe<\/strong><\/h2>\n<p>fig = px.scatter(df, x=&quot;sepal_width&quot;, y=&quot;sepal_length&quot;, color=&quot;species&quot;)<\/p>\n<h2><strong>\u663e\u793a\u56fe\u5f62<\/strong><\/h2>\n<p>fig.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>Plotly\u7684\u4ea4\u4e92\u6027\u4f7f\u5176\u6210\u4e3a\u6570\u636e\u5206\u6790\u548c\u53ef\u89c6\u5316\u7684\u4e00\u5927\u4eae\u70b9\u3002<\/strong><\/p>\n<\/p>\n<p><h3>3.3\u3001Plotly\u9ad8\u7ea7\u7ed8\u56fe<\/h3>\n<\/p>\n<p><p>Plotly\u8fd8\u652f\u6301\u5176\u4ed6\u9ad8\u7ea7\u56fe\u5f62\uff0c\u59823D\u56fe\u5f62\u3001\u5730\u56fe\u7b49\u3002<\/p>\n<\/p>\n<p><h4>3.3.1\u3001\u7ed8\u52363D\u6563\u70b9\u56fe<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import plotly.express as px<\/p>\n<h2><strong>\u521b\u5efa\u6570\u636e<\/strong><\/h2>\n<p>df = px.data.iris()<\/p>\n<h2><strong>\u7ed8\u52363D\u6563\u70b9\u56fe<\/strong><\/h2>\n<p>fig = px.scatter_3d(df, x=&#39;sepal_length&#39;, y=&#39;sepal_width&#39;, z=&#39;petal_length&#39;,<\/p>\n<p>                    color=&#39;species&#39;, symbol=&#39;species&#39;)<\/p>\n<h2><strong>\u663e\u793a\u56fe\u5f62<\/strong><\/h2>\n<p>fig.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3.3.2\u3001\u7ed8\u5236\u5730\u56fe<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import plotly.express as px<\/p>\n<h2><strong>\u52a0\u8f7d\u793a\u4f8b\u6570\u636e<\/strong><\/h2>\n<p>df = px.data.gapminder().query(&quot;year == 2007&quot;)<\/p>\n<h2><strong>\u7ed8\u5236\u5730\u56fe<\/strong><\/h2>\n<p>fig = px.choropleth(df, locations=&quot;iso_alpha&quot;, color=&quot;lifeExp&quot;,<\/p>\n<p>                    hover_name=&quot;country&quot;, color_continuous_scale=px.colors.sequential.Plasma)<\/p>\n<h2><strong>\u663e\u793a\u56fe\u5f62<\/strong><\/h2>\n<p>fig.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u901a\u8fc7\u4f7f\u7528Matplotlib\u3001Seaborn\u548cPlotly\uff0cPython\u53ef\u4ee5\u6ee1\u8db3\u4ece\u7b80\u5355\u5230\u590d\u6742\u7684\u5404\u79cd\u7ed8\u56fe\u9700\u6c42\u3002<\/strong>\u8fd9\u4e9b\u5e93\u5404\u6709\u4f18\u7f3a\u70b9\uff0c\u9009\u62e9\u54ea\u4e2a\u5e93\u53d6\u51b3\u4e8e\u4f60\u7684\u5177\u4f53\u9700\u6c42\u548c\u9879\u76ee\u80cc\u666f\u3002\u65e0\u8bba\u662f\u9759\u6001\u8fd8\u662f\u4ea4\u4e92\u5f0f\u56fe\u8868\uff0cPython\u90fd\u80fd\u63d0\u4f9b\u5f3a\u5927\u7684\u652f\u6301\uff0c\u4e3a\u6570\u636e\u5206\u6790\u548c\u53ef\u89c6\u5316\u63d0\u4f9b\u4e86\u6781\u5927\u7684\u4fbf\u5229\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u521b\u5efa\u53ef\u89c6\u5316\u56fe\u8868\uff1f<\/strong><br \/>Python\u63d0\u4f9b\u4e86\u591a\u79cd\u5e93\u6765\u751f\u6210\u56fe\u8868\u548c\u53ef\u89c6\u5316\u6570\u636e\uff0c\u5176\u4e2d\u6700\u6d41\u884c\u7684\u5305\u62ecMatplotlib\u3001Seaborn\u548cPlotly\u7b49\u3002\u4f7f\u7528\u8fd9\u4e9b\u5e93\uff0c\u7528\u6237\u53ef\u4ee5\u8f7b\u677e\u521b\u5efa\u6298\u7ebf\u56fe\u3001\u67f1\u72b6\u56fe\u3001\u997c\u56fe\u7b49\u591a\u79cd\u56fe\u8868\u5f62\u5f0f\u3002\u5bf9\u4e8e\u521d\u5b66\u8005\u6765\u8bf4\uff0c\u53ef\u4ee5\u901a\u8fc7\u5b89\u88c5\u76f8\u5e94\u7684\u5e93\u5e76\u7f16\u5199\u7b80\u5355\u7684\u4ee3\u7801\uff0c\u4f8b\u5982\u4f7f\u7528Matplotlib\u7684<code>plt.plot()<\/code>\u51fd\u6570\u6765\u7ed8\u5236\u57fa\u672c\u7684\u6298\u7ebf\u56fe\uff0c\u6216\u4f7f\u7528Seaborn\u7684<code>sns.barplot()<\/code>\u6765\u751f\u6210\u67f1\u72b6\u56fe\u3002<\/p>\n<p><strong>Python\u6709\u54ea\u4e9b\u5e38\u7528\u7684\u53ef\u89c6\u5316\u5e93\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u9664\u4e86Matplotlib\u548cSeaborn\uff0cPlotly\u548cBokeh\u4e5f\u662f\u975e\u5e38\u53d7\u6b22\u8fce\u7684\u53ef\u89c6\u5316\u5de5\u5177\u3002Matplotlib\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u7ed8\u56fe\u5e93\uff0c\u9002\u7528\u4e8e\u521b\u5efa\u9759\u6001\u56fe\u5f62\uff1bSeaborn\u5219\u5728\u5176\u57fa\u7840\u4e0a\u589e\u52a0\u4e86\u5bf9\u7edf\u8ba1\u56fe\u8868\u7684\u652f\u6301\uff0c\u63d0\u4f9b\u4e86\u66f4\u7f8e\u89c2\u7684\u9ed8\u8ba4\u6837\u5f0f\u3002Plotly\u548cBokeh\u5219\u652f\u6301\u4ea4\u4e92\u5f0f\u56fe\u8868\uff0c\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u9f20\u6807\u60ac\u505c\u7b49\u64cd\u4f5c\u4e0e\u56fe\u8868\u8fdb\u884c\u4e92\u52a8\uff0c\u9002\u5408\u6570\u636e\u5206\u6790\u548c\u5c55\u793a\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Python\u4e2d\u4fdd\u5b58\u751f\u6210\u7684\u56fe\u8868\uff1f<\/strong><br \/>\u5728\u4f7f\u7528Matplotlib\u7b49\u5e93\u7ed8\u5236\u5b8c\u56fe\u8868\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u8c03\u7528<code>savefig()<\/code>\u51fd\u6570\u5c06\u56fe\u8868\u4fdd\u5b58\u4e3a\u56fe\u50cf\u6587\u4ef6\uff0c\u4f8b\u5982PNG\u3001JPEG\u6216PDF\u683c\u5f0f\u3002\u7528\u6237\u53ef\u4ee5\u6307\u5b9a\u6587\u4ef6\u540d\u548c\u6587\u4ef6\u683c\u5f0f\uff0c\u540c\u65f6\u8fd8\u53ef\u4ee5\u8bbe\u7f6e\u56fe\u50cf\u7684\u5206\u8fa8\u7387\uff0c\u4ee5\u4fbf\u6ee1\u8db3\u4e0d\u540c\u7684\u5c55\u793a\u9700\u6c42\u3002\u5728\u8c03\u7528\u6b64\u51fd\u6570\u65f6\uff0c\u786e\u4fdd\u5728\u7ed8\u56fe\u4ee3\u7801\u7684\u672b\u5c3e\u4f7f\u7528\uff0c\u4ee5\u786e\u4fdd\u56fe\u8868\u5df2\u5b8c\u5168\u751f\u6210\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\uff0c\u7ed8\u5236\u56fe\u8868\u7684\u5e38\u7528\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528Matplotlib\u3001Seaborn\u548cPlotly\u7b49\u5e93\u3002Matpl [&hellip;]","protected":false},"author":3,"featured_media":946619,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/946615"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=946615"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/946615\/revisions"}],"predecessor-version":[{"id":946621,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/946615\/revisions\/946621"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/946619"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=946615"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=946615"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=946615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}