Inherited from the Dot Plots, Scatter plots are of very similar types. It provides a power of different features for every individual point. We are allowed to vary the size, color, and other properties of each data point and which makes data more friendly to visualize.
从继承点图 , 散点图是非常相似的类型。 它为每个单独的点提供了多种功能。 我们可以更改每个数据点的大小,颜色和其他属性,这使数据更易于可视化。
1)常规散点图 (1) Normal Scatter Plot )
Syntax:
句法:
plt.scatter(x, y, alpha=0.8)
Parameter(s):
参数:
x, y - data points in an array
x , y-数组中的数据点
Alpha = 0.8 - opaque value (0 for transparent and 1 for opaque)
Alpha = 0.8-不透明值(0表示透明,1表示不透明)

2)可变大小的散点图 (2) Scatter Plot with variable size)
Syntax:
句法:
plt.scatter(x, y, s=area, alpha=0.8)
Parameter(s):
参数:
x, y - data points in an array
x , y-数组中的数据点
Alpha = 0.8 - opaque value (0 for transparent and 1 for opaque)
Alpha = 0.8-不透明值(0表示透明,1表示不透明)
s = area - the size of each point in terms of area
s =面积 -每个点的面积(面积)

3)带有颜色代码绿色,红色,蓝色黄色的短划线点图 (3) Dash Point Plots with color code Green, Red, Blue Yellow)
Syntax:
句法:
plt.scatter(x, y, c=colors, alpha=0.8)
Parameter(s):
参数:
x, y - data points in an array
x , y-数组中的数据点
Alpha = 0.8 - opaque value (0 for transparent and 1 for opaque)
Alpha = 0.8-不透明值(0表示透明,1表示不透明)
c = colors - colors of each point
c =颜色 -每个点的颜色

4)星点图,颜色代码为蓝色,绿色,红色,黄色 (4) Star Point Plot with Color Code Blue, Green, Red, Yellow)
Syntax:
句法:
plt.scatter(x, y, c=colors, s=area, alpha=0.8)
Parameter(s):
参数:
x, y - data points in an array
x , y-数组中的数据点
Alpha = 0.8 - opaque value (0 for transparent and 1 for opaque)
Alpha = 0.8-不透明值(0表示透明,1表示不透明)
c = colors - colors of each point
c =颜色 -每个点的颜色
s = area - size of each point in terms of area
s =面积 -每个点的面积(面积)

Applications:
应用范围:
Machine Learning
机器学习
Monte Carlo Simulation
蒙特卡罗模拟
Case Studies
实例探究
Probabilistic Models
概率模型
Python代码演示散点图示例 (Python code to demonstrate example of scatter plot)
import numpy as np
import matplotlib.pyplot as plt
N = 40
x = np.random.rand(N)
y = np.random.rand(N)*10
# random colour for points, vector of length N
colors = np.random.rand(N)
# area of the circle, vectoe of length N
area = (30 * np.random.rand(N))**2
# 0 to 15 point radii
# a normal scatter plot with default features
plt.scatter(x, y, alpha=0.8)
plt.xlabel('Numbers')
plt.ylabel('Values')
plt.title('Normal Scatter Plot')
plt.show()
# a scater plot with different size
plt.figure()
plt.scatter(x, y, s=area, alpha=0.8)
plt.xlabel('Numbers')
plt.ylabel('Values')
plt.title('Different Size')
plt.show()
# a scatter plot with different collour
plt.figure()
plt.scatter(x, y, c=colors, alpha=0.8)
plt.xlabel('Numbers')
plt.ylabel('Values')
plt.title('Different Colour')
plt.show()
# A combined Scatter Plot
plt.figure()
plt.scatter(x, y, s=area, c=colors, alpha=0.8)
plt.xlabel('Numbers')
plt.ylabel('Values')
plt.title('Combined')
plt.show()
Output:
输出:
Output is as figure