官术网_书友最值得收藏!

Scatter plot

Another basic plot type is scatter plot, a plot of dots. You can draw it by calling plt.scatter(x,y). The following example shows a scatter plot of random dots:

import numpy as np
import matplotlib.pyplot as plt

# Set the random seed for NumPy function to keep the results reproducible
np.random.seed(42)

# Generate a 2 by 100 NumPy Array of random decimals between 0 and 1
r = np.random.rand(2,100)

# Plot the x and y coordinates of the random dots on a scatter plot
plt.scatter(r[0],r[1])

# Show the plot
plt.show()

The following plot is the result of the preceding code:

主站蜘蛛池模板: 扎兰屯市| 庆阳市| 博罗县| 武宁县| 方正县| 万宁市| 六安市| 扎兰屯市| 原平市| 峡江县| 深水埗区| 鸡东县| 青铜峡市| 巴彦县| 电白县| 英山县| 格尔木市| 连城县| 辽宁省| 综艺| 麟游县| 商南县| 柳江县| 乌鲁木齐市| 错那县| 恭城| 南江县| 杨浦区| 吉首市| 鹤山市| 佛山市| 湖南省| 彭山县| 尼勒克县| 泊头市| 滨州市| 扎囊县| 玉山县| 吉安市| 渭源县| 元朗区|