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

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:

主站蜘蛛池模板: 沧州市| 始兴县| 乐安县| 曲麻莱县| 湟中县| 伊宁市| 南澳县| 含山县| 阿拉善右旗| 张家界市| 昌邑市| 丰镇市| 玛纳斯县| 常山县| 蓝田县| 新安县| 时尚| 汝南县| 武川县| 宁阳县| 陇川县| 陇南市| 牡丹江市| 从江县| 治多县| 嘉鱼县| 中超| 顺义区| 封开县| 伊吾县| 格尔木市| 黔西| 江西省| 泰顺县| 垦利县| 崇明县| 东港市| 顺义区| 措勤县| 蒙山县| 黄大仙区|