{"id":933929,"date":"2024-12-26T18:24:57","date_gmt":"2024-12-26T10:24:57","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/933929.html"},"modified":"2024-12-26T18:24:58","modified_gmt":"2024-12-26T10:24:58","slug":"python%e5%a6%82%e4%bd%95%e8%b7%91%e5%9b%be","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/933929.html","title":{"rendered":"python\u5982\u4f55\u8dd1\u56fe"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25071137\/8839d3a9-bd8d-4cb4-9583-f428cefd0373.webp\" alt=\"python\u5982\u4f55\u8dd1\u56fe\" \/><\/p>\n<p><p> \u5f00\u5934\u6bb5\u843d\uff1a<\/p>\n<\/p>\n<p><p><strong>\u5728Python\u4e2d\u8dd1\u56fe\u901a\u5e38\u4f7f\u7528\u7684\u5e93\u6709Matplotlib\u3001Seaborn\u3001Plotly\u3001Bokeh\u7b49<\/strong>\u3002\u8fd9\u4e9b\u5e93\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u529f\u80fd\uff0c\u80fd\u591f\u6ee1\u8db3\u4e0d\u540c\u5c42\u6b21\u7684\u7ed8\u56fe\u9700\u6c42\u3002<strong>Matplotlib<\/strong> \u662fPython\u6700\u57fa\u7840\u7684\u7ed8\u56fe\u5e93\uff0c\u5176\u529f\u80fd\u5f3a\u5927\uff0c\u9002\u5408\u521b\u5efa\u9759\u6001\u3001\u4ea4\u4e92\u5f0f\u548c\u52a8\u753b\u53ef\u89c6\u5316\u3002<strong>Seaborn<\/strong> \u662f\u57fa\u4e8eMatplotlib\u6784\u5efa\u7684\u9ad8\u7ea7\u5e93\uff0c\u63d0\u4f9b\u4e86\u66f4\u4e3a\u7b80\u5316\u7684\u63a5\u53e3\u548c\u66f4\u7f8e\u89c2\u7684\u9ed8\u8ba4\u6837\u5f0f\u3002<strong>Plotly<\/strong> \u662f\u4e00\u4e2a\u4ea4\u4e92\u5f0f\u7ed8\u56fe\u5e93\uff0c\u7279\u522b\u9002\u5408\u9700\u8981\u5728\u7f51\u9875\u4e0a\u5c55\u793a\u52a8\u6001\u56fe\u8868\u7684\u573a\u666f\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u8fd9\u4e9b\u5de5\u5177\u8fdb\u884c\u56fe\u5f62\u7ed8\u5236\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001MATPLOTLIB\u4ecb\u7ecd\u4e0e\u7528\u6cd5<\/p>\n<\/p>\n<p><p>Matplotlib\u662fPython\u4e2d\u6700\u57fa\u7840\u4e14\u5e7f\u6cdb\u4f7f\u7528\u7684\u7ed8\u56fe\u5e93\u3002\u5b83\u63d0\u4f9b\u4e86\u4e00\u6574\u5957\u7528\u4e8e\u521b\u5efa\u56fe\u8868\u7684\u5de5\u5177\uff0c\u4ece\u7b80\u5355\u7684\u7ebf\u56fe\u5230\u590d\u6742\u76843D\u56fe\u5f62\u3002Matplotlib\u7684\u6838\u5fc3\u662f\u5176pyplot\u6a21\u5757\uff0c\u8be5\u6a21\u5757\u63d0\u4f9b\u4e86\u7c7b\u4f3cMATLAB\u7684\u754c\u9762\u3002<\/p>\n<\/p>\n<p><p>1.1\u3001\u5b89\u88c5\u4e0e\u57fa\u672c\u7528\u6cd5<\/p>\n<\/p>\n<p><p>Matplotlib\u53ef\u4ee5\u901a\u8fc7pip\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\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u521b\u5efa\u7b80\u5355\u7684\u6298\u7ebf\u56fe\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<p>x = [1, 2, 3, 4, 5]<\/p>\n<p>y = [2, 3, 5, 7, 11]<\/p>\n<p>plt.plot(x, y)<\/p>\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<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u91cc\uff0c<code>plt.plot()<\/code> \u7528\u4e8e\u7ed8\u5236\u56fe\u5f62\uff0c<code>plt.show()<\/code> \u7528\u4e8e\u663e\u793a\u56fe\u5f62\u3002<\/p>\n<\/p>\n<p><p>1.2\u3001\u7ed8\u5236\u591a\u79cd\u7c7b\u578b\u7684\u56fe\u5f62<\/p>\n<\/p>\n<p><p>\u9664\u4e86\u6298\u7ebf\u56fe\uff0cMatplotlib\u8fd8\u53ef\u4ee5\u7ed8\u5236\u67f1\u72b6\u56fe\u3001\u997c\u56fe\u3001\u6563\u70b9\u56fe\u7b49\u3002<\/p>\n<\/p>\n<ul>\n<li><strong>\u67f1\u72b6\u56fe<\/strong>\uff1a<\/li>\n<\/ul>\n<p><pre><code class=\"language-python\">labels = [&#39;A&#39;, &#39;B&#39;, &#39;C&#39;, &#39;D&#39;]<\/p>\n<p>values = [10, 20, 15, 25]<\/p>\n<p>plt.bar(labels, values)<\/p>\n<p>plt.title(&#39;Bar Chart&#39;)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ul>\n<li><strong>\u997c\u56fe<\/strong>\uff1a<\/li>\n<\/ul>\n<p><pre><code class=\"language-python\">sizes = [15, 30, 45, 10]<\/p>\n<p>labels = [&#39;A&#39;, &#39;B&#39;, &#39;C&#39;, &#39;D&#39;]<\/p>\n<p>plt.pie(sizes, labels=labels, autopct=&#39;%1.1f%%&#39;)<\/p>\n<p>plt.title(&#39;Pie Chart&#39;)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ul>\n<li><strong>\u6563\u70b9\u56fe<\/strong>\uff1a<\/li>\n<\/ul>\n<p><pre><code class=\"language-python\">x = [1, 2, 3, 4, 5]<\/p>\n<p>y = [5, 6, 2, 3, 1]<\/p>\n<p>plt.scatter(x, y)<\/p>\n<p>plt.title(&#39;Scatter Plot&#39;)<\/p>\n<p>plt.xlabel(&#39;x-axis&#39;)<\/p>\n<p>plt.ylabel(&#39;y-axis&#39;)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>Matplotlib\u7684\u5f3a\u5927\u4e4b\u5904\u5728\u4e8e\u5176\u9ad8\u5ea6\u53ef\u5b9a\u5236\u6027\uff0c\u7528\u6237\u53ef\u4ee5\u6839\u636e\u9700\u6c42\u4fee\u6539\u56fe\u5f62\u7684\u5404\u79cd\u5c5e\u6027\uff0c\u5982\u989c\u8272\u3001\u7ebf\u578b\u3001\u6807\u8bb0\u7b49\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001SEABORN\u4ecb\u7ecd\u4e0e\u7528\u6cd5<\/p>\n<\/p>\n<p><p>Seaborn\u662f\u4e00\u4e2a\u57fa\u4e8eMatplotlib\u7684\u9ad8\u7ea7\u7ed8\u56fe\u5e93\uff0c\u65e8\u5728\u4f7f\u6570\u636e\u53ef\u89c6\u5316\u66f4\u52a0\u7b80\u5355\u548c\u7f8e\u89c2\u3002\u5b83\u7684\u9ed8\u8ba4\u4e3b\u9898\u548c\u989c\u8272\u677f\u4f7f\u5f97\u7ed8\u56fe\u6548\u679c\u66f4\u52a0\u5438\u5f15\u4eba\u3002<\/p>\n<\/p>\n<p><p>2.1\u3001\u5b89\u88c5\u4e0e\u57fa\u672c\u7528\u6cd5<\/p>\n<\/p>\n<p><p>\u5b89\u88c5Seaborn\u540c\u6837\u975e\u5e38\u7b80\u5355\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install seaborn<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4f7f\u7528Seaborn\u8fdb\u884c\u7ed8\u56fe\u65f6\uff0c\u901a\u5e38\u9700\u8981\u4e0ePandas\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u5904\u7406\u548c\u5c55\u793a\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import seaborn as sns<\/p>\n<p>import pandas as pd<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u793a\u4f8b\u6570\u636e\u96c6<\/strong><\/h2>\n<p>data = pd.DataFrame({<\/p>\n<p>    &#39;x&#39;: [1, 2, 3, 4, 5],<\/p>\n<p>    &#39;y&#39;: [5, 6, 2, 3, 1]<\/p>\n<p>})<\/p>\n<p>sns.lineplot(x=&#39;x&#39;, y=&#39;y&#39;, data=data)<\/p>\n<p>plt.title(&#39;Seaborn Line Plot&#39;)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>2.2\u3001Seaborn\u7684\u9ad8\u7ea7\u56fe\u5f62<\/p>\n<\/p>\n<p><p>Seaborn\u63d0\u4f9b\u4e86\u4e00\u4e9bMatplotlib\u4e0d\u5177\u5907\u7684\u9ad8\u7ea7\u56fe\u5f62\uff0c\u5982\u70ed\u529b\u56fe\u3001\u7bb1\u7ebf\u56fe\u3001\u5206\u5e03\u56fe\u7b49\u3002<\/p>\n<\/p>\n<ul>\n<li><strong>\u70ed\u529b\u56fe<\/strong>\uff1a<\/li>\n<\/ul>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<p>data = np.random.rand(10, 12)<\/p>\n<p>sns.heatmap(data, annot=True)<\/p>\n<p>plt.title(&#39;Heatmap&#39;)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ul>\n<li><strong>\u7bb1\u7ebf\u56fe<\/strong>\uff1a<\/li>\n<\/ul>\n<p><pre><code class=\"language-python\">tips = sns.load_dataset(&quot;tips&quot;)<\/p>\n<p>sns.boxplot(x=&quot;day&quot;, y=&quot;total_bill&quot;, data=tips)<\/p>\n<p>plt.title(&#39;Box Plot&#39;)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ul>\n<li><strong>\u5206\u5e03\u56fe<\/strong>\uff1a<\/li>\n<\/ul>\n<p><pre><code class=\"language-python\">sns.distplot(tips[&#39;total_bill&#39;], kde=False, bins=20)<\/p>\n<p>plt.title(&#39;Distribution Plot&#39;)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>Seaborn\u7684\u8bbe\u8ba1\u521d\u8877\u662f\u7b80\u5316\u6570\u636e\u53ef\u89c6\u5316\u8fc7\u7a0b\uff0c\u540c\u65f6\u63d0\u4f9b\u66f4\u4e3a\u7f8e\u89c2\u7684\u9ed8\u8ba4\u6837\u5f0f\uff0c\u9002\u5408\u5feb\u901f\u5206\u6790\u548c\u5c55\u793a\u6570\u636e\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001PLOTLY\u4ecb\u7ecd\u4e0e\u7528\u6cd5<\/p>\n<\/p>\n<p><p>Plotly\u662f\u4e00\u4e2a\u7528\u4e8e\u521b\u5efa\u4ea4\u4e92\u5f0f\u56fe\u8868\u7684Python\u5e93\u3002\u5176\u5f3a\u5927\u7684\u529f\u80fd\u548c\u7075\u6d3b\u6027\u4f7f\u5176\u6210\u4e3a\u5728\u7f51\u9875\u4e0a\u5c55\u793a\u52a8\u6001\u6570\u636e\u7684\u7406\u60f3\u9009\u62e9\u3002<\/p>\n<\/p>\n<p><p>3.1\u3001\u5b89\u88c5\u4e0e\u57fa\u672c\u7528\u6cd5<\/p>\n<\/p>\n<p><p>Plotly\u7684\u5b89\u88c5\u65b9\u5f0f\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install plotly<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>Plotly\u4e2d\u6700\u5e38\u7528\u7684\u6a21\u5757\u662f<code>plotly.graph_objs<\/code>\uff0c\u7528\u4e8e\u521b\u5efa\u548c\u7ba1\u7406\u56fe\u5f62\u5bf9\u8c61\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import plotly.graph_objs as go<\/p>\n<p>from plotly.offline import plot<\/p>\n<p>x = [1, 2, 3, 4, 5]<\/p>\n<p>y = [2, 3, 5, 7, 11]<\/p>\n<p>trace = go.Scatter(x=x, y=y, mode=&#39;lines&#39;, name=&#39;Line Plot&#39;)<\/p>\n<p>layout = go.Layout(title=&#39;Plotly Line Plot&#39;)<\/p>\n<p>fig = go.Figure(data=[trace], layout=layout)<\/p>\n<p>plot(fig)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>3.2\u3001Plotly\u7684\u4ea4\u4e92\u5f0f\u56fe\u5f62<\/p>\n<\/p>\n<p><p>Plotly\u652f\u6301\u591a\u79cd\u4ea4\u4e92\u5f0f\u56fe\u5f62\uff0c\u59823D\u56fe\u5f62\u3001\u5730\u56fe\u3001\u4eea\u8868\u76d8\u7b49\u3002<\/p>\n<\/p>\n<ul>\n<li><strong>3D\u56fe\u5f62<\/strong>\uff1a<\/li>\n<\/ul>\n<p><pre><code class=\"language-python\">z = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]<\/p>\n<p>trace = go.Surface(z=z)<\/p>\n<p>layout = go.Layout(title=&#39;3D Surface Plot&#39;)<\/p>\n<p>fig = go.Figure(data=[trace], layout=layout)<\/p>\n<p>plot(fig)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ul>\n<li><strong>\u5730\u56fe<\/strong>\uff1a<\/li>\n<\/ul>\n<p><pre><code class=\"language-python\">import plotly.express as px<\/p>\n<p>df = px.data.gapminder().query(&quot;year == 2007&quot;)<\/p>\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<p>fig.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>Plotly\u7684\u5f3a\u5927\u4e4b\u5904\u5728\u4e8e\u5176\u4ea4\u4e92\u6027\u548c\u52a8\u6001\u6027\uff0c\u7528\u6237\u53ef\u4ee5\u5728\u6d4f\u89c8\u5668\u4e2d\u4e0e\u56fe\u5f62\u8fdb\u884c\u4e92\u52a8\uff0c\u9002\u5408\u9700\u8981\u5c55\u793a\u590d\u6742\u6570\u636e\u7684\u573a\u5408\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001BOKEH\u4ecb\u7ecd\u4e0e\u7528\u6cd5<\/p>\n<\/p>\n<p><p>Bokeh\u662f\u4e00\u4e2a\u4e13\u6ce8\u4e8e\u5927\u6570\u636e\u53ef\u89c6\u5316\u548c\u4ea4\u4e92\u5f0f\u56fe\u5f62\u7684Python\u5e93\u3002\u5b83\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u5de5\u5177\u6765\u521b\u5efa\u52a8\u6001\u3001\u4ea4\u4e92\u5f0f\u7684\u56fe\u8868\uff0c\u7279\u522b\u9002\u5408\u9700\u8981\u5728\u7f51\u9875\u4e0a\u5c55\u793a\u7684\u573a\u666f\u3002<\/p>\n<\/p>\n<p><p>4.1\u3001\u5b89\u88c5\u4e0e\u57fa\u672c\u7528\u6cd5<\/p>\n<\/p>\n<p><p>Bokeh\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install bokeh<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4f7f\u7528Bokeh\u521b\u5efa\u7b80\u5355\u7684\u56fe\u5f62\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from bokeh.plotting import figure, show<\/p>\n<p>from bokeh.io import output_notebook<\/p>\n<p>output_notebook()<\/p>\n<p>p = figure(title=&quot;Simple Line Example&quot;, x_axis_label=&#39;x&#39;, y_axis_label=&#39;y&#39;)<\/p>\n<p>p.line([1, 2, 3, 4, 5], [2, 3, 5, 7, 11], legend_label=&quot;Temp.&quot;, line_width=2)<\/p>\n<p>show(p)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>4.2\u3001Bokeh\u7684\u52a8\u6001\u56fe\u5f62<\/p>\n<\/p>\n<p><p>Bokeh\u652f\u6301\u521b\u5efa\u52a8\u6001\u3001\u4ea4\u4e92\u5f0f\u56fe\u5f62\uff0c\u5982\u6ed1\u5757\u3001\u4e0b\u62c9\u83dc\u5355\u7b49\u3002<\/p>\n<\/p>\n<ul>\n<li><strong>\u52a8\u6001\u6ed1\u5757<\/strong>\uff1a<\/li>\n<\/ul>\n<p><pre><code class=\"language-python\">from bokeh.layouts import column<\/p>\n<p>from bokeh.models import Slider<\/p>\n<p>from bokeh.plotting import ColumnDataSource, curdoc<\/p>\n<p>source = ColumnDataSource(data=dict(x=[1, 2, 3, 4, 5], y=[2, 3, 5, 7, 11]))<\/p>\n<p>p = figure(title=&quot;Interactive Slider Example&quot;, x_axis_label=&#39;x&#39;, y_axis_label=&#39;y&#39;)<\/p>\n<p>p.line(&#39;x&#39;, &#39;y&#39;, source=source)<\/p>\n<p>slider = Slider(start=0.1, end=10, value=1, step=.1, title=&quot;Multiplier&quot;)<\/p>\n<p>def update(attr, old, new):<\/p>\n<p>    factor = slider.value<\/p>\n<p>    source.data = dict(x=[1, 2, 3, 4, 5], y=[2 * factor, 3 * factor, 5 * factor, 7 * factor, 11 * factor])<\/p>\n<p>slider.on_change(&#39;value&#39;, update)<\/p>\n<p>curdoc().add_root(column(slider, p))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>Bokeh\u7684\u4e3b\u8981\u4f18\u52bf\u5728\u4e8e\u5176\u80fd\u591f\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u96c6\uff0c\u5e76\u4ee5\u4ea4\u4e92\u5f0f\u7684\u5f62\u5f0f\u5c55\u793a\u6570\u636e\uff0c\u9002\u5408\u9700\u8981\u5b9e\u65f6\u6570\u636e\u66f4\u65b0\u7684\u5e94\u7528\u573a\u666f\u3002<\/p>\n<\/p>\n<p><p>\u4e94\u3001\u603b\u7ed3<\/p>\n<\/p>\n<p><p>Python\u63d0\u4f9b\u4e86\u591a\u79cd\u56fe\u5f62\u7ed8\u5236\u5de5\u5177\uff0c\u6bcf\u79cd\u5de5\u5177\u90fd\u6709\u5176\u72ec\u7279\u7684\u4f18\u52bf\u548c\u9002\u7528\u573a\u666f\u3002<strong>Matplotlib<\/strong> \u9002\u5408\u9759\u6001\u56fe\u5f62\u548c\u57fa\u7840\u7ed8\u56fe\uff0c<strong>Seaborn<\/strong> \u63d0\u4f9b\u7b80\u5316\u63a5\u53e3\u548c\u7f8e\u89c2\u7684\u6837\u5f0f\uff0c<strong>Plotly<\/strong> \u548c <strong>Bokeh<\/strong> \u5219\u4e13\u6ce8\u4e8e\u4ea4\u4e92\u5f0f\u548c\u52a8\u6001\u56fe\u5f62\u3002\u6839\u636e\u9879\u76ee\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u7ed8\u56fe\u5e93\uff0c\u53ef\u4ee5\u5e2e\u52a9\u60a8\u66f4\u6709\u6548\u5730\u5c55\u793a\u548c\u5206\u6790\u6570\u636e\u3002\u65e0\u8bba\u662f\u8fdb\u884c\u6570\u636e\u5206\u6790\u3001<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u6a21\u578b\u7684\u7ed3\u679c\u5c55\u793a\uff0c\u8fd8\u662f\u521b\u5efa\u5546\u4e1a\u62a5\u544a\uff0cPython\u7684\u8fd9\u4e9b\u5de5\u5177\u90fd\u80fd\u63d0\u4f9b\u5f3a\u5927\u7684\u652f\u6301\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u4f7f\u7528\u56fe\u5f62\u5e93\u8fdb\u884c\u6570\u636e\u53ef\u89c6\u5316\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u79cd\u56fe\u5f62\u5e93\u6765\u8fdb\u884c\u6570\u636e\u53ef\u89c6\u5316\uff0c\u5305\u62ecMatplotlib\u3001Seaborn\u548cPlotly\u7b49\u3002Matplotlib\u662f\u6700\u57fa\u672c\u7684\u5e93\uff0c\u80fd\u591f\u751f\u6210\u9759\u6001\u56fe\u8868\uff1bSeaborn\u5219\u57fa\u4e8eMatplotlib\uff0c\u63d0\u4f9b\u66f4\u7f8e\u89c2\u7684\u7edf\u8ba1\u56fe\u8868\uff1b\u800cPlotly\u5219\u9002\u5408\u521b\u5efa\u4ea4\u4e92\u5f0f\u56fe\u5f62\u3002\u7528\u6237\u53ef\u4ee5\u6839\u636e\u9700\u8981\u9009\u62e9\u5408\u9002\u7684\u5e93\uff0c\u4f7f\u7528\u76f8\u5e94\u7684\u51fd\u6570\u6765\u7ed8\u5236\u56fe\u5f62\u3002<\/p>\n<p><strong>Python\u4e2d\u6709\u54ea\u4e9b\u5e38\u7528\u7684\u53ef\u89c6\u5316\u5e93\uff1f<\/strong><br \/>Python\u4e2d\u6709\u51e0\u4e2a\u6d41\u884c\u7684\u53ef\u89c6\u5316\u5e93\uff0c\u5305\u62ecMatplotlib\u3001Seaborn\u3001Plotly\u548cBokeh\u3002Matplotlib\u9002\u5408\u7ed8\u5236\u57fa\u672c\u76842D\u56fe\u5f62\uff0cSeaborn\u63d0\u4f9b\u9ad8\u7ea7\u7edf\u8ba1\u56fe\u5f62\uff0cPlotly\u80fd\u591f\u751f\u6210\u52a8\u6001\u4ea4\u4e92\u56fe\uff0c\u800cBokeh\u5219\u9002\u5408\u5236\u4f5c\u5927\u89c4\u6a21\u7684\u4ea4\u4e92\u5f0f\u53ef\u89c6\u5316\u3002\u9009\u62e9\u5408\u9002\u7684\u5e93\u53ef\u4ee5\u5e2e\u52a9\u7528\u6237\u66f4\u6709\u6548\u5730\u5c55\u793a\u6570\u636e\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Python\u4e2d\u52a0\u8f7d\u548c\u5904\u7406\u6570\u636e\u4ee5\u8fdb\u884c\u56fe\u5f62\u7ed8\u5236\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528Pandas\u5e93\u6765\u52a0\u8f7d\u548c\u5904\u7406\u6570\u636e\u3002\u901a\u8fc7Pandas\u7684read_csv()\u51fd\u6570\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u8bfb\u53d6CSV\u6587\u4ef6\u4e2d\u7684\u6570\u636e\uff0c\u5e76\u5c06\u5176\u8f6c\u6362\u4e3aDataFrame\u683c\u5f0f\u3002\u63a5\u4e0b\u6765\uff0c\u53ef\u4ee5\u5bf9\u6570\u636e\u8fdb\u884c\u6e05\u6d17\u548c\u6574\u7406\uff0c\u6bd4\u5982\u5904\u7406\u7f3a\u5931\u503c\u548c\u8fdb\u884c\u6570\u636e\u7b5b\u9009\u3002\u5904\u7406\u5b8c\u6210\u540e\uff0c\u7528\u6237\u53ef\u4ee5\u5229\u7528\u6240\u9009\u7684\u53ef\u89c6\u5316\u5e93\u5c06\u6570\u636e\u7ed8\u5236\u6210\u56fe\u8868\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5f00\u5934\u6bb5\u843d\uff1a \u5728Python\u4e2d\u8dd1\u56fe\u901a\u5e38\u4f7f\u7528\u7684\u5e93\u6709Matplotlib\u3001Seaborn\u3001Plotly\u3001Bokeh\u7b49 [&hellip;]","protected":false},"author":3,"featured_media":933932,"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\/933929"}],"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=933929"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/933929\/revisions"}],"predecessor-version":[{"id":933933,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/933929\/revisions\/933933"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/933932"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=933929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=933929"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=933929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}