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

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:

主站蜘蛛池模板: 富平县| 中西区| 铁岭县| 晋中市| 嘉祥县| 石河子市| 从化市| 墨竹工卡县| 盱眙县| 惠水县| 延津县| 云南省| 博白县| 上蔡县| 凌云县| 襄樊市| 阳信县| 苍山县| 明水县| 河曲县| 关岭| 游戏| 禹城市| 舒城县| 阿拉善左旗| 霸州市| 石泉县| 邵阳县| 冕宁县| 全南县| 辽阳县| 屏东市| 罗山县| 张掖市| 浦东新区| 怀安县| 奉贤区| 德保县| 禄劝| 武城县| 凤山县|