{"id":1124424,"date":"2025-01-08T19:41:24","date_gmt":"2025-01-08T11:41:24","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1124424.html"},"modified":"2025-01-08T19:41:26","modified_gmt":"2025-01-08T11:41:26","slug":"%e5%a6%82%e4%bd%95%e5%b0%86python%e7%9a%84%e8%bf%90%e8%a1%8c%e7%bb%93%e6%9e%9c%e5%8f%af%e8%a7%86%e5%8c%96","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1124424.html","title":{"rendered":"\u5982\u4f55\u5c06python\u7684\u8fd0\u884c\u7ed3\u679c\u53ef\u89c6\u5316"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25085457\/0fb4616e-6f91-432f-9b66-9e1a2e911406.webp\" alt=\"\u5982\u4f55\u5c06python\u7684\u8fd0\u884c\u7ed3\u679c\u53ef\u89c6\u5316\" \/><\/p>\n<p><p> <strong>\u5982\u4f55\u5c06Python\u7684\u8fd0\u884c\u7ed3\u679c\u53ef\u89c6\u5316\uff1a\u4f7f\u7528Matplotlib\u3001Seaborn\u3001Plotly\u3001Pandas<\/strong><\/p>\n<\/p>\n<p><p>\u5c06Python\u7684\u8fd0\u884c\u7ed3\u679c\u8fdb\u884c\u53ef\u89c6\u5316\u662f\u6570\u636e\u5206\u6790\u548c\u79d1\u5b66\u8ba1\u7b97\u4e2d\u81f3\u5173\u91cd\u8981\u7684\u4e00\u73af\u3002\u901a\u8fc7\u53ef\u89c6\u5316\uff0c\u6570\u636e\u7684\u5185\u5728\u6a21\u5f0f\u548c\u8d8b\u52bf\u53ef\u4ee5\u66f4\u76f4\u89c2\u5730\u5c55\u73b0\u51fa\u6765\uff0c\u4ece\u800c\u66f4\u5bb9\u6613\u7406\u89e3\u548c\u5206\u6790\u3002<strong>Matplotlib\u3001Seaborn\u3001Plotly\u3001Pandas<\/strong>\u662f\u51e0\u79cd\u5e38\u7528\u7684Python\u53ef\u89c6\u5316\u5de5\u5177\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u8fd9\u4e9b\u5de5\u5177\u6765\u8fdb\u884c\u6570\u636e\u53ef\u89c6\u5316\uff0c\u5176\u4e2d\u91cd\u70b9\u4ecb\u7ecdMatplotlib\u3002<\/p>\n<\/p>\n<hr>\n<p><h3>\u4e00\u3001Matplotlib\uff1a\u57fa\u672c\u7ed8\u56fe\u5de5\u5177<\/h3>\n<\/p>\n<p><p>Matplotlib \u662fPython\u4e2d\u6700\u57fa\u7840\u548c\u5e7f\u6cdb\u4f7f\u7528\u7684\u7ed8\u56fe\u5e93\uff0c\u5b83\u80fd\u591f\u751f\u6210\u5404\u79cd\u9759\u6001\u3001\u52a8\u6001\u548c\u4ea4\u4e92\u5f0f\u7684\u56fe\u8868\u3002\u5b83\u7684\u529f\u80fd\u5f3a\u5927\u4e14\u7075\u6d3b\uff0c\u80fd\u591f\u6ee1\u8db3\u4ece\u7b80\u5355\u5230\u590d\u6742\u7684\u5404\u79cd\u7ed8\u56fe\u9700\u6c42\u3002<\/p>\n<\/p>\n<p><h4>1.1 \u5b89\u88c5\u548c\u57fa\u672c\u4f7f\u7528<\/h4>\n<\/p>\n<p><p>\u8981\u4f7f\u7528Matplotlib\uff0c\u9996\u5148\u9700\u8981\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><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u4ee3\u7801\u6765\u751f\u6210\u4e00\u4e2a\u7b80\u5355\u7684\u6298\u7ebf\u56fe\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<h2><strong>\u51c6\u5907\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<\/strong><\/h2>\n<p>plt.plot(x, y)<\/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.2 \u81ea\u5b9a\u4e49\u56fe\u5f62<\/h4>\n<\/p>\n<p><p>Matplotlib\u63d0\u4f9b\u4e86\u591a\u79cd\u81ea\u5b9a\u4e49\u56fe\u5f62\u7684\u65b9\u6cd5\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e\u56fe\u5f62\u7684\u6807\u9898\u3001\u8f74\u6807\u7b7e\u3001\u56fe\u4f8b\u7b49\u6765\u589e\u5f3a\u56fe\u5f62\u7684\u53ef\u8bfb\u6027\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<h2><strong>\u51c6\u5907\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<\/strong><\/h2>\n<p>plt.plot(x, y, label=&#39;Prime Numbers&#39;, color=&#39;b&#39;, linestyle=&#39;--&#39;, marker=&#39;o&#39;)<\/p>\n<h2><strong>\u8bbe\u7f6e\u6807\u9898\u548c\u6807\u7b7e<\/strong><\/h2>\n<p>plt.title(&#39;Simple Line Plot&#39;)<\/p>\n<p>plt.xlabel(&#39;X Axis&#39;)<\/p>\n<p>plt.ylabel(&#39;Y Axis&#39;)<\/p>\n<h2><strong>\u663e\u793a\u56fe\u4f8b<\/strong><\/h2>\n<p>plt.legend()<\/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 \u5b50\u56fe\u548c\u591a\u56fe<\/h4>\n<\/p>\n<p><p>\u5728\u6570\u636e\u5206\u6790\u4e2d\uff0c\u7ecf\u5e38\u9700\u8981\u5728\u540c\u4e00\u4e2a\u56fe\u5f62\u4e2d\u5c55\u793a\u591a\u4e2a\u5b50\u56fe\u3002Matplotlib\u63d0\u4f9b\u4e86<code>subplot<\/code>\u51fd\u6570\u6765\u5b9e\u73b0\u8fd9\u4e00\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<h2><strong>\u51c6\u5907\u6570\u636e<\/strong><\/h2>\n<p>x = [1, 2, 3, 4, 5]<\/p>\n<p>y1 = [2, 3, 5, 7, 11]<\/p>\n<p>y2 = [1, 4, 9, 16, 25]<\/p>\n<h2><strong>\u521b\u5efa\u56fe\u5f62<\/strong><\/h2>\n<p>plt.subplot(2, 1, 1)<\/p>\n<p>plt.plot(x, y1, &#39;r--&#39;)<\/p>\n<p>plt.title(&#39;First Subplot&#39;)<\/p>\n<p>plt.subplot(2, 1, 2)<\/p>\n<p>plt.plot(x, y2, &#39;g*-&#39;)<\/p>\n<p>plt.title(&#39;Second Subplot&#39;)<\/p>\n<h2><strong>\u663e\u793a\u56fe\u5f62<\/strong><\/h2>\n<p>plt.tight_layout()<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001Seaborn\uff1a\u9ad8\u7ea7\u7edf\u8ba1\u56fe\u5f62\u5e93<\/h3>\n<\/p>\n<p><p>Seaborn \u662f\u57fa\u4e8eMatplotlib\u6784\u5efa\u7684\u9ad8\u7ea7\u7edf\u8ba1\u56fe\u5f62\u5e93\uff0c\u7279\u522b\u9002\u5408\u7528\u4e8e\u521b\u5efa\u7f8e\u89c2\u548c\u4fe1\u606f\u4e30\u5bcc\u7684\u7edf\u8ba1\u56fe\u8868\u3002\u5b83\u5185\u7f6e\u4e86\u8bb8\u591a\u9ed8\u8ba4\u4e3b\u9898\u548c\u989c\u8272\u8c03\u8272\u677f\uff0c\u53ef\u4ee5\u8ba9\u56fe\u5f62\u66f4\u52a0\u7f8e\u89c2\u3002<\/p>\n<\/p>\n<p><h4>2.1 \u5b89\u88c5\u548c\u57fa\u672c\u4f7f\u7528<\/h4>\n<\/p>\n<p><p>\u8981\u4f7f\u7528Seaborn\uff0c\u9996\u5148\u9700\u8981\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install seaborn<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u4ee3\u7801\u6765\u751f\u6210\u4e00\u4e2a\u7b80\u5355\u7684\u6563\u70b9\u56fe\uff1a<\/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>\u51c6\u5907\u6570\u636e<\/strong><\/h2>\n<p>tips = sns.load_dataset(&quot;tips&quot;)<\/p>\n<h2><strong>\u521b\u5efa\u6563\u70b9\u56fe<\/strong><\/h2>\n<p>sns.scatterplot(x=&quot;total_bill&quot;, y=&quot;tip&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><h4>2.2 \u9ad8\u7ea7\u7ed8\u56fe<\/h4>\n<\/p>\n<p><p>Seaborn \u63d0\u4f9b\u4e86\u8bb8\u591a\u9ad8\u7ea7\u7ed8\u56fe\u529f\u80fd\uff0c\u6bd4\u5982\u7bb1\u7ebf\u56fe\u3001\u70ed\u529b\u56fe\u3001\u5bf9\u89d2\u7ebf\u56fe\u7b49\uff0c\u53ef\u4ee5\u7528\u6765\u5c55\u793a\u6570\u636e\u7684\u5206\u5e03\u548c\u76f8\u5173\u6027\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>\u51c6\u5907\u6570\u636e<\/strong><\/h2>\n<p>tips = sns.load_dataset(&quot;tips&quot;)<\/p>\n<h2><strong>\u521b\u5efa\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><h3>\u4e09\u3001Plotly\uff1a\u4ea4\u4e92\u5f0f\u56fe\u5f62\u5e93<\/h3>\n<\/p>\n<p><p>Plotly \u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u4ea4\u4e92\u5f0f\u56fe\u5f62\u5e93\uff0c\u53ef\u4ee5\u7528\u6765\u521b\u5efa\u9ad8\u5ea6\u81ea\u5b9a\u4e49\u548c\u4ea4\u4e92\u5f0f\u7684\u6570\u636e\u53ef\u89c6\u5316\u56fe\u8868\u3002\u5b83\u652f\u6301\u591a\u79cd\u56fe\u8868\u7c7b\u578b\uff0c\u5305\u62ec\u6298\u7ebf\u56fe\u3001\u6563\u70b9\u56fe\u3001\u67f1\u72b6\u56fe\u3001\u997c\u56fe\u7b49\u3002<\/p>\n<\/p>\n<p><h4>3.1 \u5b89\u88c5\u548c\u57fa\u672c\u4f7f\u7528<\/h4>\n<\/p>\n<p><p>\u8981\u4f7f\u7528Plotly\uff0c\u9996\u5148\u9700\u8981\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install plotly<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u4ee3\u7801\u6765\u751f\u6210\u4e00\u4e2a\u7b80\u5355\u7684\u4ea4\u4e92\u5f0f\u6298\u7ebf\u56fe\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import plotly.express as px<\/p>\n<h2><strong>\u51c6\u5907\u6570\u636e<\/strong><\/h2>\n<p>df = px.data.iris()<\/p>\n<h2><strong>\u521b\u5efa\u6298\u7ebf\u56fe<\/strong><\/h2>\n<p>fig = px.line(df, x=&quot;sepal_width&quot;, y=&quot;sepal_length&quot;, title=&quot;Sepal Width vs Sepal Length&quot;)<\/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.2 \u9ad8\u7ea7\u7ed8\u56fe<\/h4>\n<\/p>\n<p><p>Plotly \u652f\u6301\u591a\u79cd\u9ad8\u7ea7\u7ed8\u56fe\u529f\u80fd\uff0c\u6bd4\u59823D\u56fe\u5f62\u3001\u5730\u56fe\u7b49\uff0c\u53ef\u4ee5\u7528\u6765\u5c55\u793a\u590d\u6742\u7684\u591a\u7ef4\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import plotly.express as px<\/p>\n<h2><strong>\u51c6\u5907\u6570\u636e<\/strong><\/h2>\n<p>df = px.data.iris()<\/p>\n<h2><strong>\u521b\u5efa3D\u6563\u70b9\u56fe<\/strong><\/h2>\n<p>fig = px.scatter_3d(df, x=&quot;sepal_length&quot;, y=&quot;sepal_width&quot;, z=&quot;petal_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><h3>\u56db\u3001Pandas\uff1a\u6570\u636e\u5206\u6790\u4e0e\u53ef\u89c6\u5316<\/h3>\n<\/p>\n<p><p>Pandas \u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u6570\u636e\u5206\u6790\u5de5\u5177\uff0c\u5b83\u96c6\u6210\u4e86\u6570\u636e\u5904\u7406\u548c\u53ef\u89c6\u5316\u529f\u80fd\u3002Pandas \u53ef\u4ee5\u4e0eMatplotlib\u548cSeaborn\u7ed3\u5408\u4f7f\u7528\uff0c\u751f\u6210\u5404\u79cd\u7edf\u8ba1\u56fe\u8868\u3002<\/p>\n<\/p>\n<p><h4>4.1 \u5b89\u88c5\u548c\u57fa\u672c\u4f7f\u7528<\/h4>\n<\/p>\n<p><p>\u8981\u4f7f\u7528Pandas\uff0c\u9996\u5148\u9700\u8981\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install pandas<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u4ee3\u7801\u6765\u751f\u6210\u4e00\u4e2a\u7b80\u5355\u7684\u6298\u7ebf\u56fe\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<p>import matplotlib.pyplot as plt<\/p>\n<h2><strong>\u51c6\u5907\u6570\u636e<\/strong><\/h2>\n<p>data = {&#39;x&#39;: [1, 2, 3, 4, 5], &#39;y&#39;: [2, 3, 5, 7, 11]}<\/p>\n<p>df = pd.DataFrame(data)<\/p>\n<h2><strong>\u521b\u5efa\u6298\u7ebf\u56fe<\/strong><\/h2>\n<p>df.plot(x=&#39;x&#39;, y=&#39;y&#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>4.2 \u9ad8\u7ea7\u7ed8\u56fe<\/h4>\n<\/p>\n<p><p>Pandas \u63d0\u4f9b\u4e86\u8bb8\u591a\u9ad8\u7ea7\u7ed8\u56fe\u529f\u80fd\uff0c\u53ef\u4ee5\u7528\u6765\u5c55\u793a\u6570\u636e\u7684\u5206\u5e03\u548c\u76f8\u5173\u6027\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<p>import seaborn as sns<\/p>\n<h2><strong>\u51c6\u5907\u6570\u636e<\/strong><\/h2>\n<p>tips = sns.load_dataset(&quot;tips&quot;)<\/p>\n<p>df = pd.DataFrame(tips)<\/p>\n<h2><strong>\u521b\u5efa\u7bb1\u7ebf\u56fe<\/strong><\/h2>\n<p>df.boxplot(column=[&#39;total_bill&#39;, &#39;tip&#39;], by=&#39;day&#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>\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u5c06Python\u7684\u8fd0\u884c\u7ed3\u679c\u8fdb\u884c\u53ef\u89c6\u5316\u662f\u6570\u636e\u5206\u6790\u548c\u79d1\u5b66\u8ba1\u7b97\u4e2d\u81f3\u5173\u91cd\u8981\u7684\u4e00\u73af\u3002<strong>Matplotlib\u3001Seaborn\u3001Plotly\u3001Pandas<\/strong>\u662f\u51e0\u79cd\u5e38\u7528\u7684Python\u53ef\u89c6\u5316\u5de5\u5177\u3002Matplotlib \u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u4e14\u7075\u6d3b\u7684\u57fa\u7840\u7ed8\u56fe\u5e93\uff0c\u9002\u5408\u5404\u79cd\u7b80\u5355\u5230\u590d\u6742\u7684\u7ed8\u56fe\u9700\u6c42\uff1bSeaborn \u662f\u57fa\u4e8eMatplotlib\u6784\u5efa\u7684\u9ad8\u7ea7\u7edf\u8ba1\u56fe\u5f62\u5e93\uff0c\u7279\u522b\u9002\u5408\u7528\u4e8e\u521b\u5efa\u7f8e\u89c2\u548c\u4fe1\u606f\u4e30\u5bcc\u7684\u7edf\u8ba1\u56fe\u8868\uff1bPlotly \u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u4ea4\u4e92\u5f0f\u56fe\u5f62\u5e93\uff0c\u53ef\u4ee5\u7528\u6765\u521b\u5efa\u9ad8\u5ea6\u81ea\u5b9a\u4e49\u548c\u4ea4\u4e92\u5f0f\u7684\u6570\u636e\u53ef\u89c6\u5316\u56fe\u8868\uff1bPandas \u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u6570\u636e\u5206\u6790\u5de5\u5177\uff0c\u96c6\u6210\u4e86\u6570\u636e\u5904\u7406\u548c\u53ef\u89c6\u5316\u529f\u80fd\u3002\u901a\u8fc7\u638c\u63e1\u8fd9\u4e9b\u5de5\u5177\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u5730\u5c06Python\u7684\u8fd0\u884c\u7ed3\u679c\u8fdb\u884c\u53ef\u89c6\u5316\uff0c\u4ece\u800c\u66f4\u76f4\u89c2\u5730\u5c55\u793a\u548c\u5206\u6790\u6570\u636e\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u9009\u62e9\u9002\u5408\u7684\u53ef\u89c6\u5316\u5e93\u6765\u5c55\u793aPython\u7684\u8fd0\u884c\u7ed3\u679c\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u6709\u591a\u79cd\u53ef\u89c6\u5316\u5e93\u53ef\u4f9b\u9009\u62e9\uff0c\u6bd4\u5982Matplotlib\u3001Seaborn\u3001Plotly\u548cBokeh\u7b49\u3002Matplotlib\u662f\u4e00\u4e2a\u57fa\u7840\u5e93\uff0c\u9002\u5408\u5236\u4f5c\u7b80\u5355\u7684\u56fe\u8868\uff1bSeaborn\u5728Matplotlib\u57fa\u7840\u4e0a\u8fdb\u884c\u4e86\u7f8e\u5316\uff0c\u9002\u5408\u8fdb\u884c\u7edf\u8ba1\u6570\u636e\u7684\u53ef\u89c6\u5316\uff1bPlotly\u5219\u652f\u6301\u4ea4\u4e92\u5f0f\u56fe\u8868\uff0c\u9002\u5408\u9700\u8981\u5c55\u793a\u52a8\u6001\u6570\u636e\u7684\u573a\u666f\uff1bBokeh\u540c\u6837\u652f\u6301\u4ea4\u4e92\u5f0f\u53ef\u89c6\u5316\uff0c\u7279\u522b\u9002\u5408\u5927\u6570\u636e\u96c6\u7684\u5904\u7406\u3002\u9009\u62e9\u5408\u9002\u7684\u5e93\u53d6\u51b3\u4e8e\u4f60\u7684\u5177\u4f53\u9700\u6c42\u548c\u6570\u636e\u7c7b\u578b\u3002<\/p>\n<p><strong>\u5982\u4f55\u5c06\u6570\u636e\u4ecePandas DataFrame\u8f6c\u5316\u4e3a\u53ef\u89c6\u5316\u56fe\u8868\uff1f<\/strong><br \/>\u4f7f\u7528Pandas\u5904\u7406\u6570\u636e\u540e\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u5229\u7528\u5176\u5185\u7f6e\u7684\u53ef\u89c6\u5316\u529f\u80fd\u3002\u8c03\u7528DataFrame\u7684<code>plot()<\/code>\u65b9\u6cd5\u53ef\u4ee5\u5feb\u901f\u751f\u6210\u56fe\u8868\u3002\u6839\u636e\u9700\u8981\uff0c\u53ef\u4ee5\u6307\u5b9a\u56fe\u8868\u7c7b\u578b\uff08\u5982\u6298\u7ebf\u56fe\u3001\u67f1\u72b6\u56fe\u7b49\uff09\uff0c\u5e76\u901a\u8fc7\u53c2\u6570\u8bbe\u7f6e\u56fe\u8868\u7684\u6837\u5f0f\u548c\u6807\u7b7e\u3002\u6b64\u5916\uff0c\u7ed3\u5408Matplotlib\uff0c\u53ef\u4ee5\u8fdb\u4e00\u6b65\u81ea\u5b9a\u4e49\u56fe\u8868\u7684\u5916\u89c2\uff0c\u4f8b\u5982\u6dfb\u52a0\u6807\u9898\u3001\u8bbe\u7f6e\u5750\u6807\u8f74\u6807\u7b7e\u7b49\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Python\u4e2d\u5b9e\u73b0\u4ea4\u4e92\u5f0f\u53ef\u89c6\u5316\uff1f<\/strong><br \/>\u8981\u5b9e\u73b0\u4ea4\u4e92\u5f0f\u53ef\u89c6\u5316\uff0c\u53ef\u4ee5\u4f7f\u7528Plotly\u6216Bokeh\u7b49\u5e93\u3002\u8fd9\u4e9b\u5e93\u5141\u8bb8\u7528\u6237\u901a\u8fc7\u9f20\u6807\u60ac\u505c\u3001\u7f29\u653e\u548c\u70b9\u51fb\u7b49\u64cd\u4f5c\u4e0e\u56fe\u8868\u8fdb\u884c\u4e92\u52a8\u3002\u4f8b\u5982\uff0c\u4f7f\u7528Plotly\u521b\u5efa\u56fe\u8868\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7<code>plotly.express<\/code>\u6a21\u5757\u63d0\u4f9b\u7684\u51fd\u6570\uff0c\u8f7b\u677e\u751f\u6210\u4ea4\u4e92\u5f0f\u56fe\u8868\u3002Bokeh\u5219\u901a\u8fc7\u521b\u5efaWeb\u5e94\u7528\u7a0b\u5e8f\u5b9e\u73b0\u56fe\u8868\u7684\u4ea4\u4e92\u6027\uff0c\u9002\u5408\u5c55\u793a\u590d\u6742\u6570\u636e\u7684\u60c5\u51b5\u3002\u901a\u8fc7\u8fd9\u4e9b\u5e93\uff0c\u7528\u6237\u53ef\u4ee5\u66f4\u76f4\u89c2\u5730\u5206\u6790\u6570\u636e\u8d8b\u52bf\u548c\u5173\u7cfb\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5982\u4f55\u5c06Python\u7684\u8fd0\u884c\u7ed3\u679c\u53ef\u89c6\u5316\uff1a\u4f7f\u7528Matplotlib\u3001Seaborn\u3001Plotly\u3001Pandas \u5c06P [&hellip;]","protected":false},"author":3,"featured_media":1124428,"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\/1124424"}],"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=1124424"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1124424\/revisions"}],"predecessor-version":[{"id":1124432,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1124424\/revisions\/1124432"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1124428"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1124424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1124424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1124424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}