Python Data Science 简明教程
Python - Scatter Plots
散点图显示在笛卡尔平面上绘制的许多点。每个点代表两个变量的值。一个变量选择在水平轴中,另一个选择在垂直轴中。
Scatterplots show many points plotted in the Cartesian plane. Each point represents the values of two variables. One variable is chosen in the horizontal axis and another in the vertical axis.
Drawing a Scatter Plot
可以使用 DataFrame.plot.scatter() 方法创建散点图。
Scatter plot can be created using the DataFrame.plot.scatter() methods.
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.rand(50, 4), columns=['a', 'b', 'c', 'd'])
df.plot.scatter(x='a', y='b')
它的 output 如下所示 −
Its output is as follows −